Parent reference for auto mapped component

Original Post Asger Hallas's Avatar

Asger Hallas

02 Jun, 2010 11:05 AM via web

Hi

Is there a way to have a parent reference on an automapped component? By having for example a property named Parent or something like that? I can't seem to find any information about how to do it or issues about it.

Cheers,
Asger Hallas

  1. 2 Posted by Asger Hallas on 08 Jun, 2010 07:00 AM

    Asger Hallas's Avatar

    I took the liberty of cross posting this to stackoverflow.com. I will post it here, if I get a usable answer.

    I'm still very interested of cause in hearing from you guys here :)

    Have a good day!
    Asger

  2. 3 Posted by Lars Udengaard on 08 Jun, 2010 07:03 AM

    Lars Udengaard's Avatar

    I'm having the same problem. And i also very much interested in the answer for this.
    Hope to hear from you.

    /Lars

  3. 4 Posted by PrzemasG on 08 Jun, 2010 01:46 PM

    PrzemasG's Avatar

    Hello

    I've got the same problem. And even more, I'd like to have possibility of manipulating on instance object for changing column name or key name, but instance is of wrong type, mayby not wrong type, but not gives methods like Column(name), Not.Nullable(), ForeignKey(name) etc
    I'm eager to hear from about this.
    Bye

  4. 5 Posted by PrzemasG on 10 Jun, 2010 03:39 PM

    PrzemasG's Avatar

    Sorry, I checked that in newest version of Fluent there is functionality of manipulating on Properties but there is not the same on References. I made some magic to unhide References:)

        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 is five times five?

    Recent Discussions

    05 Jul, 2010 10:29 PM
    05 Jul, 2010 12:45 PM
    05 Jul, 2010 12:42 PM
    05 Jul, 2010 12:17 PM
    05 Jul, 2010 12:12 PM

     

    03 Jul, 2010 12:26 AM
    02 Jul, 2010 02:17 PM
    02 Jul, 2010 08:18 AM
    02 Jul, 2010 12:20 AM
    01 Jul, 2010 10:14 PM