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

[Solved] Scope and Transaction...

5 Answers 176 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.
MWM
Top achievements
Rank 1
MWM asked on 18 Jan 2009, 09:51 PM
I understand it's required to get a Scope object in order to interact with the DB, but what about a Transaction? 

1.  Do I need a transaction ONLY when I'm going to actually write to the DB (e.g. create / update / delete a record), or even when reading from the DB and hence any interaction with the DB?  In other words, if I retrieve a set of records within a scope object, can I eliminate the transaction (if so, better to keep it and why?) and then use a transaction when I go to ALTER/CREATE/DELETE records?

2.  Can you provide example code of what might appear in the app_start method when dealing with / setting up the SessionFactory?  I can't remember the name of it, but it seems like it included "factory".  The idea was it was very expensive to create, but only needs to be created once for a given session (whereas scope is created and destroyed each DB access use).  Once you show the app_start code, can you show how it's used thereafter in code-behind pages (in C# preferably)?

Thanks for assistance!

5 Answers, 1 is accepted

Sort by
0
Zoran
Telerik team
answered on 20 Jan 2009, 04:24 PM
Hello Mark

As you assumed, transaction is needed only when updating the database. I think our Knowledge-Base article regarding the CRUD - operations will provide additional information to understand the process. I would also recommend you to download one of the sample projects from our Code Library where the use of the ObjectScopeProvider (our SessionFactory implementation) is present in the business logic project.

Do not hesitate to share your experience with OpenAccess or ask any questions you might have.

All the best,
Zoran
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
MWM
Top achievements
Rank 1
answered on 21 Jan 2009, 03:33 AM
I've looked at the samples in the code library.  They are indeed helpful, but they are Win apps.  Can you show the same/similar as a web app also in C#?

0
Zoran
Telerik team
answered on 21 Jan 2009, 03:44 PM
Hi Mark,

Web examples are currently in the process of development and will be available in our code library soon, most probably in our next major release. At the moment you can look at our QuickStart web examples which might help you also.

What I can assure you is that we have development of Web application real case scenario in our TODO list and we will start development very soon. It will be available through the CodeLibrary first.



Kind regards,
Zoran
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
MWM
Top achievements
Rank 1
answered on 28 Jan 2009, 01:50 AM
Zoran,

I was doing some reading in the help for OA and ran across this in the "

Getting Started >

 

Introduction to Programming with OpenAccess ORM > Transparent Persistence

 

" section:

*************

All database operations on persistent instances in the database are always performed in the context of a transaction.

Database operations include addition, deletion or modification of objects in the database as well as reading objects

from the database. Transactions have further been described in

 

Transactions.
*************

What you had responded, which made sense to me (i.e. one only needs to use a transaction when changing the database), conflicts with this in the help.  Can you clarify please?

Thank you.

 

0
Zoran
Telerik team
answered on 28 Jan 2009, 10:53 AM
Hello Mark,

Some of the sections of the current version of the help are written for an older version of the Vanatec OpenAccess. Currently we are developing a new help solution for Telerik OpenAccess which will include documentation of our new and improved features as well as re-designing some sections of the help that are presently available. When appropriate please use the Knowledge-Base as a resource  for getting you more familiar with our product whenever possible, as it includes the most recent articles available.
 
Please do not hesitate to share any other similar findings, they will be of great help for us to make the new documentation more useful for our clients. Your Telerik points were updated.

Regards,
Zoran
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
MWM
Top achievements
Rank 1
Answers by
Zoran
Telerik team
MWM
Top achievements
Rank 1
Share this question
or