rams
rams

Reputation: 652

how to save custom object into sqlite database on windows phone8 using c#?

how to save custom object into sqlite database on windows phone8 using c#?

public class Person
    {

        public int Id { get; set; }


        public string Name { get; set; }


        public string Surname { get; set; }

        public List<Address> Items { get; set; }

        public List<SubAddress> Subaddress { get; set; }

    }
    public class Address
    {
        public string city { get; set; }
        public string state { get; set; }
        public string pin { get; set; }
        public List<SubAddress> Subaddress { get; set; }
    }
    public class SubAddress
    {
        public string SubAddresscity { get; set; }
        public string SubAddressstate { get; set; }
        public string SubAddresspin { get; set; }
    }




     Person person = new Person
            {
                Name = "Matteo",
                Surname = "Pagani",
                Items = new List<Address> 
                { 
                    new Address 
                    { 
                        city="fdsdf",state="sfds",pin="dsfsd",Subaddress=new List<SubAddress>
                        {
                            new SubAddress
                            {
                                SubAddresscity="llll",
                                SubAddressstate="ffff",
                                SubAddresspin="gggg"
                            },
                             new SubAddress
                            {
                                SubAddresscity="llll",
                                SubAddressstate="ffff",
                                SubAddresspin="gggg"
                            },
                             new SubAddress
                            {
                                SubAddresscity="llll",
                                SubAddressstate="ffff",
                                SubAddresspin="gggg"
                            }
                        },

                    },                    
                    new Address
                    {
                        city="fdsdf",state="sfds",pin="dsfsd",Subaddress=new List<SubAddress>
                        {
                             new SubAddress
                            {
                                SubAddresscity="llll",
                                SubAddressstate="ffff",
                                SubAddresspin="gggg"
                            },
                             new SubAddress
                            {
                                SubAddresscity="llll",
                                SubAddressstate="ffff",
                                SubAddresspin="gggg"
                            }
                        }
                    },
                    new Address
                    {
                        city="fdsdf",state="sfds",pin="dsfsd",Subaddress=new List<SubAddress>
                        {
                             new SubAddress
                            {
                                SubAddresscity="llll",
                                SubAddressstate="ffff",
                                SubAddresspin="gggg"
                            }
                        }
                    },
                    new Address
                    {
                        city="fdsdf",state="sfds",pin="dsfsd",Subaddress=new List<SubAddress>
                        {                            
                        }
                    }
                },
                Subaddress = new List<SubAddress>
                {
                             new SubAddress
                            {
                                SubAddresscity="llll",
                                SubAddressstate="ffff",
                                SubAddresspin="gggg"
                            },
                             new SubAddress
                            {
                                SubAddresscity="llll",
                                SubAddressstate="ffff",
                                SubAddresspin="gggg"
                            },
                             new SubAddress
                            {
                                SubAddresscity="llll",
                                SubAddressstate="ffff",
                                SubAddresspin="gggg"
                            },
                             new SubAddress
                            {
                                SubAddresscity="llll",
                                SubAddressstate="ffff",
                                SubAddresspin="gggg"
                            }
                }

            };

how to save person object directly into database and how to retrieve object ?

is it possible or not is possible can you please help me to achieve .

thanks ......

Upvotes: 1

Views: 1066

Answers (1)

crea7or
crea7or

Reputation: 4490

Your question is very broad. At first, you should learn - how to store objects in tables. Then, how to store complex objects in tables etc. It's impossible to answer with a few lines of text. Even general understanding of SQL databases is required.

Upvotes: 1

Related Questions