Why IComponentConvention.References is not of type IManyToOneInsance?

PrzemasG's Avatar

PrzemasG

09 Jun, 2010 10:35 AM via web

Hi

I wonder why IComponentConvention.References is not of type IManyToOneInsance but is of type IManyToOneInspector?? Is it a mistake or it simply should be like that?
Lastly you fixed Properties property and I thought the References property should allow to manipulate on Column and ForeignKey too.
Can you tell me if you are working on it or don't you know about this yet?

Regards
PrzemasG

  1. 2 Posted by PrzemasG on 10 Jun, 2010 03:36 PM

    PrzemasG's Avatar

    OK, I managed with this by myself:
    I use function below instead of References property:

        public static IEnumerable<IManyToOneInstance> GetReferences( IComponentInstance instanace )
        {
            Type t = instanace.GetType();
            FieldInfo fi = t.GetField("mapping", BindingFlags.Instance | BindingFlags.NonPublic);
            if (fi == null)
                new ArgumentNullException("There is no 'mappings' in IComponentInstance");
    
            return ((ComponentMapping)fi.GetValue(instanace)).References.Select(x => new ManyToOneInstance(x)).Cast<IManyToOneInstance>();
        }
    

Reply to this discussion

Preview Comments are parsed with Markdown. Help with syntax

Attached Files

    You can attach files up to 10MB

    What day comes after Monday?