To answer your first question, there are two approaches to querying your database using OpenAccess ORM:
1) Using the auto-generated classes of your Domain Model, you can directly write LINQ queries using the model as a context for the query. The queries can either be packed in dedicated classes or you can write them directly in any project that refers to your DAL assembly. This is the most commonly used approach and it is the one I have recommended in my previous post.
2) You can write your queries using our ADO API, which gives you the freedom to write any
SQL statements that might be needed by your application.
In any case, you need to have your classes defined and mapped to the database tables. Those definitions have to be in your DAL.
As for your second question, the Domain Model is just a context for database access. You will still have to define the specific queries you will need – either in your DAL or BLL, or even UI layer where appropriate. The value for you is that you will most probably be querying classes through LINQ, instead of tables through SQL.
Finally, you don’t need to build methods for accessing the database itself. You can just use your classes and OpenAccess ORM provides you the API needed to create, retrieve, update or delete data. However, for your complex functionality for working with data, you might have to create additional utility classes, working with OpenAccess ORM persistent classes.
There are different types of resources you can use to get started and SDK is probably the best option.
You can start by reviewing some introduction articles in the documentation, they are quite explanatory.
Then you can take a look at the SDK sample Linq101Samples (specifically for queries) and the 3 N-Tier development projects demonstrating separation of layers through different kinds of services. You can also check out some of the other samples based on your scenario.
Do not hesitate to let us know if you have further questions.
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward!
We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>