Documentation and/or Samples

Sep 25, 2009 at 5:18 PM

Hello All -

We are looking at several ORM at work and we would like to give your some serious consideration.  However, I am finding both the documentation and any samples to be rather sparse.  I've downloaded the full source code and noticed some new projects like Chili.Opf3.Query.StoredProcedures, but I do not see any documentation on this nor samples where it is used.  We are trying to implement an ORM that runs via stored procedures.  I know that is not necessarily the best method when dynamic generation is possible, but we have to stick with the guidelines we have here at work.  With that said, are there any samples or documentation showing me how I can override the dynamic generation of SQL and use stored procedures for all of my database operations?  I did read up on the object query as a possible solution, but I am interested in knowing what this additional StoredProcedure project is and how that may help in my scenario where StoredProcedures are required for all data access.

 

Thanks.

Coordinator
Sep 27, 2009 at 6:40 PM

Hi,

you should have a look at the ObjectContext's PersistentQueriesProviders property and the IPersistentQueriesProvider interface. These allow you to customize the SQL that is executed during insert, update and delete. Have also a look at the SqlQuery class. It allows you create SQL statements and execute them against Opf3. You could use them for the load through stored procedures, and also as return values for the methods in IPersistentQueriesProvider.

I hope this helps.

-Christian

Oct 8, 2009 at 3:43 PM

Thank you for this information.  I was able to use the PersistentQueriesProvider to use stored procedures for insert, update, and delete.  Additionally, I was able to create a base class that utilized a StoredProcedureQuery in order to do all my fetching operations.  However, in doing this, I have lost the ability to lazy load using the stored procedure mindset.  Lazy loading does work, but it fetches the collections based on generated SQL instead of stored procedures.  With that said, is there anyway to override the load methods in a manner that would allow me to use your relation constructs with stored procedures?

Coordinator
Oct 10, 2009 at 4:17 AM
Edited Oct 10, 2009 at 4:18 AM

Hi! I am sorry. That hasn't been implemented properly yet. Right now stored procedures are only supported in the PersistentQueriesProvider and through the StoredProcedureQuery. The only way you could this get working is to set the StoredProcedureQuery as argument of the constructor of the Object(Set)Holder. One of the constructors takes an IQuery:

/// <summary> 
/// Creates a new instance of the <see cref="ObjectSetHolder{T}">ObjectSetHolder Class</see>. 
/// </summary> 
/// <param name="query"><see cref="Opf3.Query.IQuery">IQuery</see> that is executed to load the associated 
/// objects. This parameter allows you to use any kind of query without using the build in functionality.</param> 
public ObjectSetHolder(IQuery query) : base(query)

-Christian