DAL in seperate class

5 posts, 1 answers
  1. Duncan
    Duncan avatar
    93 posts
    Member since:
    Jul 2012

    Posted 28 Aug 2011 Link to this post

    Evening everyone,

    I have just started using OpenAccess as my ORM. I need some base structure and setup help if possible.

    I have a created a new Telerik OpenAccess Class Library called "DataAccessLayer". I then have my EntitiesModel.rlinq file in these and have imported the database model from the DB.

    Then i have my client project. I add the DataAccessLayer as a reference and attempt working with the ORM as normal.

    When atttempting to use the DAL class i get a number of wierd errors, for example: The type 'Telerik.OpenAccess.OpenAccessContext' is defined in an assembly that is not referenced.

    Does anyone have a good example of this type of structure, all the examples i have found have the DAL as part of the client project. And yes i have built a console app and everything works perfectly. What am i missing???

    Please any help or examples would be great!

    Duncan
  2. TSE
    TSE avatar
    381 posts
    Member since:
    Sep 2008

    Posted 29 Aug 2011 Link to this post

    Hi Duncan,

    Is this a web project or...?

    Anyway, I usually have a Model library that holds the generated entities,
    like Customer, Order, Invoice, etc.
    This is referenced in all the other layers.

    Then I have a repository/manager library that holds method to work on the model,
    like CreateOrder, UpdateOrder, FindOrdersByDateInterval, etc.

    On top of the repository I have my client (web, WCF, console, etc..)

    So the repository references the model. The client references the repository and the model (because you work with your entities in the client layer)

    Regards

    Henrik
  3. DevCraft banner
  4. Answer
    Kosta Hristov
    Admin
    Kosta Hristov avatar
    13 posts

    Posted 29 Aug 2011 Link to this post

    Hello Henrik,

    Along with the reference to your DAL project, the Telerik.OpenAccess and Telerik.OpenAccess.35.Extensions assemblies should also be referenced by the client project. This will fix the OpenAccessContext related error you receive.

    As a fast way to familiarize yourself with OpenAccess, we recommend checking out the new OpenAccess ORM SDK. Inside, you will find various best practices examples divided by area, language and complexity.

    As an alternative, you can also check our quick start tutorials located in the OpenAccess ORM  documentation.

    If you need further assistance, please do not hesitate to ask.

    All the best,
    Kosta
    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 >>

  5. TSE
    TSE avatar
    381 posts
    Member since:
    Sep 2008

    Posted 29 Aug 2011 Link to this post

    Hi Kosta,

    Thanks for providing the links, but that's exactly what I wrote:

    <snip>
    So the repository references the model. The client references the repository and the model (because you work with your entities in the client layer)
    </snip>

    Best regards

    Henrik

  6. Duncan
    Duncan avatar
    93 posts
    Member since:
    Jul 2012

    Posted 29 Aug 2011 Link to this post

    Kosta,

    Tat seemed to do the trick, i did not realize that each class library and client project must have the OpenAccess DLL's referenced. Adding these DLLs to the BLL and the client program seemed to clean up the errors i was seeing.

    Thanks,

    Duncan
Back to Top
DevCraft banner