Print Page | Close Window

Custom DataSourceKeyResolver Issue

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1673
Printed Date: 18-May-2025 at 4:43am


Topic: Custom DataSourceKeyResolver Issue
Posted By: robdrye
Subject: Custom DataSourceKeyResolver Issue
Date Posted: 04-Mar-2010 at 6:05pm
We have been testing out an implementation of IDataSourceKeyResolver recently and all appeared to be working perfectly until we attempt to save changes on newly created Entities.  We consistently get this Exception:
 
IdGenerator problem - not all temp ids converted to permanent ids./nIf you are using auto-incrementing ids check that the FixupTempIds SaveOption is set to InSaveListOnly./nThis may also occur if your custom IIdGenerator was not found or its GetRealIdMap method did not/nprovide a corresponding real id for each temp id.
 
As soon as we disable the IDataSourceKeyResolver implementation and go back to the config files for the edm keys all is well.
 
This is the IDataSourceKeyResolver implementation we have been testing with:
 
[Serializable]
internal class SessionDataSourceKeyResolver : IDataSourceKeyResolver
{
    public IDataSourceKey GetKey(string keyName, string keyExtension, bool onServer)
    {
        string connString = SystemSettings.GetConnectionString(SystemConnectionType.System).ConnectionString;
        string provider = SystemSettings.DataProvider;
        string container = GetContainer(keyName);
        string edmx = "metadata=res://*/DataModel.{0}.csdl|res://*/DataModel.{1}.ssdl|res://*/DataModel.{2}.msl;provider={3};provider connection string=\"{4};MultipleActiveResultSets=True\"";
        string devConn = String.Format(edmx, new object[] { container, container, container, provider, connString });
        return new ClientEdmKey(keyName, devConn, ("PBI.Workspace.DataModel." + container), false, new string[] { "PBI.Workspace" }, "", new string[] { });
    }
}
 
Any feedback is much appreciated.



Replies:
Posted By: ting
Date Posted: 05-Mar-2010 at 4:25pm
Hi robdrye - We received your email and will follow up with you there.



Print Page | Close Window