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

6 posts, 0 answers
  1. Jin
    Jin avatar
    80 posts
    Member since:
    Jun 2012

    Posted 22 Aug 2012 Link to this post

    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?



  2. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 23 Aug 2012 Link to this post

    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!
  3. DevCraft banner
  4. Jin
    Jin avatar
    80 posts
    Member since:
    Jun 2012

    Posted 23 Aug 2012 Link to this post

    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.


  5. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 28 Aug 2012 Link to this post

    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!
  6. Jin
    Jin avatar
    80 posts
    Member since:
    Jun 2012

    Posted 28 Aug 2012 Link to this post

    Hi Zoran,

    In your case, how to auto generate method for store procedure if the entity and context class in two projects?
  7. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 29 Aug 2012 Link to this post

    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!
Back to Top
DevCraft banner