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

Openacessontext or scope (multiple users)

1 Answer 53 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
fabrice
Top achievements
Rank 1
fabrice asked on 10 Dec 2012, 03:00 PM
Hi,

My company start a new project using Telerik's OpenAccess ORM. This is a new product to us, and the first time we'll be using an ORM for a project instead of a Dataset based approach. We have problems regarding the best way to use openaccesscontext.

Our project is composed :
- DAL : OpenAccessContext
- WCF : CRUD services
- UI : WPF in client side
- program in server side exposing WCF services

Each user ( 1 to 100 users simultaneously) will have a wpf based client that "talks" to WCF services.
Should we use one openaccesscontext for each user or one context for all users ? with  L2 cache  enabled ?
Should we use one scope for each user or one scope for all users ?
What is the best practise ?

Regards

1 Answer, 1 is accepted

Sort by
0
Viktor Zhivkov
Telerik team
answered on 13 Dec 2012, 09:34 AM
Hi Fabrice,

Thank you for your interest in our product.
If you have used typed datasets in your previous projects you will be able to reuse a lot of your experience working with data records represented as objects (classes). The main difference will be the way data is queried from the database and how changes are send back to the database server. If you have done it yet you can read our Getting Started guide and our Quick Start tutorials.

In addition to online articles we are providing OpenAccess SDK (http://www.telerik.com/products/orm/features/sdk.aspx) that contains numerous examples with complete code that demonstrate how to integrate OpenAccess and different technology stacks or architectures. One of our examples will be interesting for you because it demonstrates N-Tier application that has WPF client and WCF Plain Service based server side. You can find that sample in the SDK under WPF-> Sofia Car Rental - WCF Plain Services. If you are interested feel free to take a look at all other examples found in the SDK.


If you like to implement the WPF client as a full blown application that contains the business logic of your application you can easily expose your data through WCF Plain Services using Add OpenAccess Service wizard. If you prefer to implement a thin client you should put the business logic on the server side and implement a few service methods that cover the use cases for each user type.

In general I always recommend to have stateless service if possible so I would say that you can start with one context per client request and enable the Level 2 Cache for the whole service application. Level 2 Caching will enable your services to skip querying the database for some of the commonly used pieces of data and there for improve the performance.
Going with one context per request will enable you to handle transactions easier and without any overhead for synchronization and locking since each context will manage automatically it's own transactions.

If you need any further assistance getting started with OpenAccess or during the design and the implementation of you project, do not hesitate to contact us.

All the best,
Viktor Zhivkov
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
Tags
General Discussions
Asked by
fabrice
Top achievements
Rank 1
Answers by
Viktor Zhivkov
Telerik team
Share this question
or