开发者

How to use Entity Framework 4.0 with Xml or in-memory Storage (non-SQL)

How do I specify Xml or just in-memory storge for Entity Framework models? The connection string requires a provider (usually a SQL provider string). But it won't let me omit the provider.

I realize I could completely throw away the designer generated objects and go pure POCO, but then I'd have to implement my own serialization layer (could do that, but it's overkill for the tiny project I'm working on).

Is there built-in support in EF 4.0 for this that I'm missing or do I just need to go the pure POCO route and discard the designer开发者_运维技巧 experience entirely :(


If you want to store data in Xml or memory you should probably not use EF. EF is designed to work with relational databases.

See also: Entity Framework with XML Files

For storing data in memory use System.Runtime.Caching

For storing data in xml files see: http://msdotnetsupport.blogspot.com/2007/04/reading-and-writing-xml-files-using-c.html


This is a good way to do what you're probably thinking.

Use a SQLite db as the backing store. That way you get you're single local file and you can still use almost all of EF.

http://dotnet.dzone.com/news/sqlite-entity-framework-4

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜