What do I need to access my own Database?
I need to write a specialized, embedded database for some .net Apps. The database开发者_StackOverflow part itself is no problem (as said, it's specialized), but the access to it from my .net code is.
I was thinking of using LINQ as the only data access (so no ADO.net, which is fine for the scenario), but I've never done that and I wonder what I actually need to implement?
Do I need IQueryable? Is there a set of Standard methods/Interfaces I need to implement? Is there a standard for writing data or do I need to create my own semantics for it?
Do I need IQueryable?
Yes, this is where LINQ hooks up.
Is there a standard for writing data or do I need to create my own semantics for it?
Your own. OTOH that is normally the easier part - you normally dout do a JOIN or something when you update a row.
I personally use BLToolkit quite often these days (need something fast and leightweight). They have a SqlQuery object that can manipualte classes to tables. GOod enough for most direct db manipulation (and I dont use change tracking - most of my objets never change but are versioned in the database).
LINQ providers are quite complicated. As is writing an execution engine. Sure you want to go that way?
Writing your own linq provider is very difficult - I looked into it a while back and got discouraged... may still do it though.
See the answers here - a couple of tutorials are linked to.
精彩评论