Entity Framework with text files (no database!)

情到浓时终转凉″ 提交于 2019-12-04 03:33:08

问题


I'm used to Forms and DataSets but now I'm trying out WPF and the Entity Framework. My goal is to fill a DataGrid in WPF with the use of the Entity Framework. However, I do NOT have a database! I have simple text files with data that I have to parse to fill my Entities.

However, I get errors like "Entity type 'TableName' is not mapped." and crashes like that I don't have a connection string.

Is it possible to use the Entity Framework without a database? Or do I have to go back to use a DataSet?


回答1:


Interesting idea. Microsoft's quite enthusiastic that in theory you can write an EF provider that maps to any kind of data store. I've not got experience with one that maps to a text file, but this link suggests that someone's done it with CSV(!): http://social.msdn.microsoft.com/Forums/ar-SA/adodotnetentityframework/thread/a0e9e20f-66d2-447c-8b7e-75de18535e63?persist=True

If you're stuck with using text files though, why not try LINQ to XML?

And: Entity Framework with XML Files



来源:https://stackoverflow.com/questions/6944357/entity-framework-with-text-files-no-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!