如何插入复杂的模型在SQLite表? [英] How to insert complex models in a sqlite table?

查看:158
本文介绍了如何插入复杂的模型在SQLite表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,如果这个问题似乎并不亲一口,但是我不知道如何处理它,我应该道歉的。

First of all I should apologize if the question doesn't seem a pro one however I have no idea how to deal with it.

其实,我有一个Person类,其中有另一个类,即地址和地址类本身有它的类型是另一类即省和市的属性。

I actually have a Person class in which there are another class namely Address and the Address class itself have properties whose types are another class namely Province and City.

public class Province
{
    public string Name { get; set; }
}

public class City
{
    public string Name { get; set; }
}

public class Address
{
    public Province Province { get; set; }
    public City City { get; set; }
    public string Street { get; set; }
    public string PostalCode { get; set; }
}

public class Person
{
    public long Id { get; set; }
    public string Name { get; set; }
    public string Phone { get; set; }
    public Address { get; set; }

}



我应该说我用的MongoDB和工作很多人可能跟MongoDB的知道你可以插入,更新和删除文件本身。但现在我正在工作的公司正在向Windows应用商店的应用程序,看来,它不与MongoDB的工作,所以我决定,而不是然而,使用SQLite,正如我刚才所说我也真的不知道如何设计了表格,这样我可以读,写我一个人反对到他们。

I should say I used to work with Mongodb and as many of you may know with Mongodb you can insert , update and delete the document itself . But now the company which I'm working for is moving to windows store applications and it appears that it doesn't work with Mongodb so I've decided to use Sqlite instead however, as I said earlier I have really have no idea how to design the tables so that I can read and write my person objects into them.

所以,我需要你的帮助非常糟糕。请把我在正确的道路。任何帮助表示赞赏。先谢谢了。

So I need your help very badly. please put me in the right path. Any help is appreciated. Thanks in advance.

推荐答案

SQLLite是非常类似于普通的SQL数据库,但在复杂的功能部分切开,你可以创建一个人表中的所有字段(这是类属性),并插入到表,并选择相应数据在必要时

SQLLite is much similar to the normal SQL database but some cutdown on complex functionalities, you can create a persons table with all the fields (which are the class properties) and insert it into the table, and select the data accordingly whenever necessary

这篇关于如何插入复杂的模型在SQLite表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆