开发者

SQLite.NET to EF, 'property' but is used like a 'type'

I use 'SQLite-1.0.66.0-setup.exe' from开发者_Python百科 http://sqlite.phxsoftware.com/. I have a db of 'World.db3' with 3 tables City, Country, CountryLanguage. I use VS2008 to generate a demo.edmx from that db.

But in the programming:

WorldEntities we = new WorldEntities(); is right.

WorldEntities.City city = new WorldEntities.City(); is error.

It says:

'WorldEntities.City' is a 'property' but is used like a 'type'.

But I can see the City in demo.Designer.cs.

public partial class WorldEntities : global::System.Data.Objects.ObjectContext

public partial class City : global::System.Data.Objects.DataClasses.EntityObject


WorldEntities is your context, the City is a property on that object.

Remove the prefix "WorldEntities." and add the appropriate namespace for the type City.

eg.

ModelNamespace.City city = new ModelNamespace.City();


WorldEntities is a class not a namespace so you need to write:

WorldEntities we = new WorldEntities();
we.City = new City();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜