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

DAL in seperate class

4 Answers 124 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Duncan
Top achievements
Rank 2
Duncan asked on 28 Aug 2011, 11:59 PM
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

4 Answers, 1 is accepted

Sort by
0
IT-Als
Top achievements
Rank 1
answered on 29 Aug 2011, 08:37 AM
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
0
Accepted
Kosta Hristov
Telerik team
answered on 29 Aug 2011, 12:29 PM
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 >>

0
IT-Als
Top achievements
Rank 1
answered on 29 Aug 2011, 12:57 PM
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

0
Duncan
Top achievements
Rank 2
answered on 29 Aug 2011, 06:36 PM
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
Tags
Getting Started
Asked by
Duncan
Top achievements
Rank 2
Answers by
IT-Als
Top achievements
Rank 1
Kosta Hristov
Telerik team
Duncan
Top achievements
Rank 2
Share this question
or