I've followed your Instructional Unit about using Stored Procedures to do all the persistence.
I've implemented a StoredProcedureDataProvider that do the same things of yours (I've copied it and modified some minor things like parameter names etc...).
My database (SQL 2005) has 2 schemas, all 2 schemas are mapped using Object Mapper with 2 keys that have full permission for mapping porpouses.
At runtime inside IdeaBlade.ibconfig the 2 keys have been modified with different connection strings: "default" with full rights (sa) that is used in Entities mapped to "dbo" schema, "cmp" with a user that is owner of "cmp" schema (used in Entities mapped to that schema)and can only execute on "dbo" schema, this for security porpouses.
All Insert/Update/Delete SPs belong to "cmp" schema so my classes can to that (in fact, Update and Delete DO WORK!)
With Management Studio I've prepared and runned (runned, using "cmp" account to be sure) the stored procedure "usp_IdeaBlade_SqlIdentityGenerator" and all works great, assuring me that user "cmp" has the right to execute even the "usp_IdeaBlade_SqlIdentityGenerator" SP (as well as all dbo's SP).
When, in my code, I try to invoke "SaveChanges" of the PM, it throw an exception:
((IdeaBlade.Persistence.PersistenceManagerSaveException)(ex))
Save failed - Length cannot be less than zero.
Parameter Name: length
"IdeaBlade.Persistence"
" in IdeaBlade.Persistence.PersistenceManager.DoSaveDataSet(IEnumerable pDataRows, SaveOptions pSaveOptions)
in IdeaBlade.Persistence.PersistenceManager.SaveChanges(IEnumerable pDataRows, SaveOptions pSaveOptions)
in IdeaBlade.Persistence.PersistenceManager.SaveChanges()
in ConsoleApplication1.Program2.Save(PersistenceManager pm) in F:\Visual Studio 2005\Projects\DevForceTest\ConsoleApplication1\Program2.cs:riga 35"
((System.ArgumentOutOfRangeException)(ex.InnerException))
Length cannot be less than zero.
Parameter Name: length
"mscorlib"
" in System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
in System.String.Substring(Int32 startIndex, Int32 length)
in IdeaBlade.Persistence.Server.TransactionManagerHelper.SaveTableWithSqlProcPart2(EntityTable pTable)
in IdeaBlade.Persistence.Server.TransactionManagerHelper.SaveTable(EntityTable pTable, Boolean pDeleting, PostSaveHandler pPostSaveHandler, Boolean pExcludeFromRefetch)
in IdeaBlade.Persistence.Server.TransactionManagerHelper.SaveTableWithSqlProc(RdbKey pRdbKey, EntityTable pTable, Boolean pExcludeFromRefetch)
in IdeaBlade.Persistence.Server.TransactionManagerHelper.Save(DataSet pDataSet, SaveOptions pSaveOptions)"
It seems to be something that doesn't belong to my implementation but maybe a bug when using a custom IAdapterProvider in conjunction with usp_IdeaBlade_SqlIdentityGenerator.
I've some limitation about users that can access datasource and StoredProcedures for CRUD opreations are by design.
Thank you for all support.
Edited by greenman - 05-Sep-2007 at 2:00am