views:

710

answers:

1

Simply put: I have a database design in my head and I now want to use Visual Studio 2010 to create a WPF application. Key is to use the VS2010 tools to take much as possible manual work out of my hands.

-The database engine is SQLite

-ORM probably through DBLINQ

-Use of LINQ

-The application can create new, empty database instances

-Easily maintainable (changes in data model possible)

Q- How do I start designing the database model (visually) in Visual Studio 2010? Should this be an xsd? Do I do this in a separate project?

Q- Next, how can I make the most use of VS2010 code generation tools to generate a Data Access Layer?

Q- I suppose the Data Access Layer will be added as a Data Source (in another project?) and from there it's a rather generic data binding solution?

I tried finding clear examples of this but it's a jungle out there, the hunt for a solution is NOT converging to one clear method.... :_(

Edit: changed 'business layer' to 'Data Access Layer', as that's really what I meant.

Update: So I decided to use ADO.NET entity framework, DBLINQ is out of the picture. I downloaded and installed the System.Data.SQLite ADO.NET provider which integrates with VS2010. From the VS2010 Server Explorer one can create and design a new database but it could be done with a standalone tool for SQLite as well. I then created a new WPF application project, and in the solution explorer added an ADO.NET Entity Data Model, which automatically generates an edmx with C# code (which is the Data Access Layer) from the already created database file. WAF (waf.codeplex.com) seems like a good idea to implement the rest but plain LINQ to SQL will do. This (click here) is also a very helpful question on stackoverflow.

A: 

Kay,

Please consider using ADO .NET Framework. It's supported by VS 2010 and LINQ (quick article).

There is one thing you must know before designing your architecture. BLL (Business Logic Layer) is a layer of logic specific for a particular data usage, hence cannot be generated automatically by (whatever you will use) framework. I guess you had Data Access Layer in mind - don't worry about that - if you're going to use ADO .NET and LINQ to Entities, DAL will be generated for you automatically. LINQ to Entities together with ADO .NET Framework are powerful set of tools which should 100% cover your needs. Additional info about LINQ to Entities.

Please feel free to ask if you have any questions.

Piotr Justyna
Thanks, Piotr. I think the next best alternative would be LINQ to SQL? (I'd have no conceptual model then though). The application is not really big, I'm dealing with 20 to 30 database tables. I found something about Entity Framework, the "Vote of No Confidence", you must've heard of this. This might hardly be relevant, also with VS2010. Comments?
Kay Zed
If your project is not very big LINQ to SQL seems to be a good option. I use ADO .NET with VS 2008 and 2010 and never had problems. I guess you can give it a shot.
Piotr Justyna
Kay Zed
Great. This code does look complex indeed but you will probably never open this file by yourself. Yes, you can find your database mapped in this single file. This will work perfectly well with WPF - you just have to define appropriate bindings. To find more information about querying your database using the mapping framework please take a look at this website: http://msdn.microsoft.com/en-us/library/bb738458.aspx If my answer was helpful please mark it as helpful and accept it can help others with similar questions.
Piotr Justyna