This is a migrated thread and some comments may be shown as answers.

Is there a demo to show a sample to using OpenAccess ORM in n-layer architecture?

5 Answers 82 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jin
Top achievements
Rank 1
Jin asked on 23 Aug 2012, 03:19 AM
In my original architecture, it have four layers: UI Layer, Business Layer, Entity Layer and DataAccess Layer. The Entity Layer will put strongly typed DataSet, all other layers will refer the Entity project. In DataAccess Layer, it will have some methods to handle all database operation with DataSet. After I review the OpenAccess ORM, I have following query:

If I create a EntitiesModel.rlinq object from existring Database, whether the file need to put under DataAccess project? If so, whether UI also need to refer DataAccess project because the generated entity class is under EntitiesModel.rlinq?



5 Answers, 1 is accepted

Sort by
0
Doroteya
Telerik team
answered on 23 Aug 2012, 09:46 AM

Hi Jin,

In general OpenAccess ORM will be used in both your Entity Layer and as a Data Access layer. In fact, you can just merge those two layers in one project. OpenAccess can be integrated as a code generation solution so that you can define your classes in the Visual Designer or as Code-Only Fluent Mapping. OpenAccess will also generate for you an OpenAccessContext which will be used for any activities concerning the database (CRUD operations, stored procedure calls, etc.).

The best practice in your case is to add a Telerik OpenAccess Class Library to your solution. It will run the OpenAccess New Domain Model wizard that will guide you through the setup of the .rlinq file. Since you have already created your database, you can use the detailed description here to navigate within that process.

The OpenAccess New Domain Model wizard, however, won’t add references to the OpenAccessModel project in the other assemblies in your solution (if any already). You have to do this manually following these steps:
1) Go to the project that will use the model
2) Add a reference to the model project in it
3) Add references to Telerik.OpenAccess.dll and Telerik.OpenAccess.35.Extensions.dll too
4) Copy the connection string from the App.config file of the model project to the corresponding place in the configuration file of the project that will use it (if that project doesn’t contain a *.config file, copy the App.config file from the model project and paste it in it)

 More details about that process are available here.

You can also check the Quick – Start Scenarios folder in our documentation to get a better overview on how to combine Telerik OpenAccess ORM with the different .Net User Interface Platforms. 

Do not hesitate to get back to us if you have additional questions.

All the best,

Doroteya
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
0
Jin
Top achievements
Rank 1
answered on 23 Aug 2012, 02:30 PM
Yes, OpenAccess ORM is put under one project is more simple for developer. But it will have some risk because if UI want to use entity class, it must refer the OpenAccess ORM project. At the same time, the Context class is also exposed in UI layer. It's not good to let developer to have chance to control the DB operation directly.


0
Zoran
Telerik team
answered on 28 Aug 2012, 01:02 PM
Hi Jin,

 There is also an option to have the .rlinq file in one project, say the Entity Layer and the context class in another project, the DataAccess Layer for example. This way you will not have access from your UI layer to the database operations layer performed by the context. Have a look in this help article to get an overview about how this can be achieved.

Kind regards,
Zoran
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
0
Jin
Top achievements
Rank 1
answered on 28 Aug 2012, 01:42 PM
Hi Zoran,

In your case, how to auto generate method for store procedure if the entity and context class in two projects?
0
Doroteya
Telerik team
answered on 29 Aug 2012, 02:11 PM
Hi Jin,

Please find the answer to this question here in the thread we discussed previously. 


Kind regards,
Doroteya
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
Tags
Data Access Free Edition
Asked by
Jin
Top achievements
Rank 1
Answers by
Doroteya
Telerik team
Jin
Top achievements
Rank 1
Zoran
Telerik team
Share this question
or