There is a problem in IdeaBlade.Core.TypeWrapper when using two entity types in one projection
I have a projection that has two properties, each from different assemblies. The GetTypeUsingMap() method does not support this. The code that loops through the __userAssemblyMapping dictionary needs to be improved to support this.
This is the error I get:
System.Func`2[[TaxOffice.Model.OwnerAddress, TaxOffice.Model.SL,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null],[SMI.Common.Model.Address, SMI.Common.Model.SL,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib,
Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
I've put a temporary patch in my web server global.asax for now
I ensure that both model assemblies exist in the user mapping by simply checking the TypeWrapper for the objects. I then add a simple entry to the system mapping to replace any Model.SL with Model (which works in my case)
protected void Application_Start(object sender, EventArgs e)
{
System.Web.Hosting.HostingEnvironment.RegisterVirtualPathProvider(new IdeaBlade.EntityModel.Web.ServiceVirtualPathProvider());
AddType("TaxOffice.Model.OwnerAddress, TaxOffice.Model.SL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
AddType("SMI.Common.Model.Address, SMI.Common.Model.SL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
var systemMapping = (Dictionary<string, string>)typeof(TypeWrapper).GetField("__systemAssemblyMapping", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
systemMapping.Add("Model.SL", "Model");
}
public bool AddType(string name)
{
try
{
var wrapper = new TypeWrapper(null);
wrapper.GetType().GetProperty("AssemblyQualifiedName").SetValue(wrapper, name);
wrapper.GetType().GetProperty("IsNull").SetValue(wrapper, false);
return wrapper.Type != null;
}
catch
{
return false;
}
}
|
Edited by smi-mark - 11-Apr-2013 at 9:58am