0

Hello I am presently converting the xml mappings to code mappings and I am stuck at one place as I am not getting the proper way to convert ManyToOne Mappings.

The XML Mappings are

 </many-to-one>
    <many-to-one class="MyProject.Activity.Communication, MyProject.Activity" name="Comm">
  <column name="CommID" />
</many-to-one>

Now I have this MyProject.Activity.Communication in other solution and don't have any reference in my mapping project. I want to specify class in my code mappings.

ManyToOne(x => x.Comm, map =>
        {
            map.Column("CommID");
        });

How do I specify class in this mapping as the Entity name is referenced so I need to add the class in my code mappings.

Moiz
  • 2,409
  • 5
  • 27
  • 50
  • I know that this is not the answer, just a comment. But it simply does not make sense to have Mapping project NOT referencing POCO project. It does not have make sense... no advantage... – Radim Köhler Jan 07 '15 at 08:54
  • Actually I have one pluggin(Activity) so that is being referenced by one ParentCommunication which is being referenced. SO when the pluggins that added, it will pick that. Everything is working in my project with XML mappings, but as the xml mappings takes string in classname it will resolve with windsor and as I am converting the mappings by code, I am not able to add the class name. Is there any property like EntityName we have in ISET? – Moiz Jan 07 '15 at 08:58
  • There is POCO project referenced but it extends it behaviour with this Activity – Moiz Jan 07 '15 at 08:59
  • what about `map.Class(typeof(ClassName));` – Radim Köhler Jan 07 '15 at 09:00
  • yes I tried this but the typeof(**) requires a classname which is not referenced in this mapping project. And this mapping project is referenced to that activity so I can't make a circular reference – Moiz Jan 07 '15 at 09:01
  • What should I say? ;) ;) ;) good luck sir... – Radim Köhler Jan 07 '15 at 09:02
  • :( there is no possibility to make an entity name ? then I think I have to change the Activity domain to fit in this mappings. – Moiz Jan 07 '15 at 09:04

1 Answers1

0

The mappings would be using Reflection to fetch the assembly name.

ManyToOne(x => x.Survey, map =>
    {
        map.Column("SurveyID");
        map.Class(Type.GetType("MyProject.Activity.Communication, MyProject.Activity"));
    });
Moiz
  • 2,409
  • 5
  • 27
  • 50