New Posts New Posts RSS Feed: Type locator issue
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Type locator issue

 Post Reply Post Reply
Author
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Topic: Type locator issue
    Posted: 30-Apr-2013 at 5:58pm
Mark, these type locator issues have been fixed in the 7.1.2 release.
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 11-Apr-2013 at 10:52am
Yea, this is similar to the other issue except even if the assembly names are the same it will still fail, as it uses two different assemblies. We have just switched to code first for most of our projects, so that's why we're only finding this now. We will never go back to that EDMX designer again :)
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 11-Apr-2013 at 10:45am
Thanks, Mark. As you know, we have an outstanding bug with type mapping (reported by you with projections - http://www.ideablade.com/forum/forum_posts.asp?TID=3822). We'll bump up the priority to get this fixed in a near future release. Glad you found a workaround for now.
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 11-Apr-2013 at 10:12am
FYI, in my projection this is where the problem is coming from:

PrimaryOwnerAddress = a.AccountOwners.Where(ao => ao.IsPrimary).SelectMany(ao => ao.Owner.OwnerAddresses).Where(oa => oa.IsPrimary).Select(oa => oa.Address).FirstOrDefault(),
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 11-Apr-2013 at 9:58am
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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down