Note that there are some explanatory texts on larger screens.

plurals
  1. POAutomapping a class with a property that is derrived from List<T>
    primarykey
    data
    text
    <p>I have a class that I am trying to use the Automapping feature of Fluent on.</p> <p>The class has a list of objects that are contained in a special class which is contains a List. It is basically written to handle auto locking of the List through various thread.</p> <p>Basically here is a similar mockup: </p> <pre><code>public class Garage { private MutexList&lt;Vehicles&gt; vehicles = new MutexList&lt;Vehicles&gt;(); public virtual MutexList&lt;Vehicles&gt; Vehicles { get { return vehicles; } set { vehicles = value; } } } public class MutexList&lt;T&gt; { private List&lt;T&gt; list = new List&lt;T&gt;(); private readonly int timeout = 1000; public List&lt;T&gt; List { get { return list; } set { list = value; } } } </code></pre> <p>Here is my auto mapping call:</p> <pre><code> try { var cfg = new StoreConfiguration(); var _factory = Fluently.Configure() .Database( MsSqlConfiguration .MsSql2008 .ConnectionString("Server=192.168.0.115;Initial Catalog=EMTRAC3;User ID=EMCollector;Password=9o0(O);") .ShowSql() ) .Mappings(m =&gt; m.AutoMappings.Add( AutoMap.AssemblyOf&lt;Product&gt;(cfg) ).ExportTo(@"C:\Temp\Fluent") ) .BuildConfiguration() .BuildSessionFactory(); } catch (Exception exc) { MessageBox.Show(exc.Message); } </code></pre> <p>And finally here is the ShouldMap function which I'm not entirely sure why I to call this but without it I don't map anything:</p> <pre><code> public class StoreConfiguration : DefaultAutomappingConfiguration { public override bool ShouldMap(Type type) { return type.Name == "Garage" || type.Namespace.Contains("Mutex"); } } </code></pre> <p>Can someone tell me I have to do to be able to map the Garage Class with all the Vehicles contained within the List of Vehicles? I'm trying to use the AutoMapping to generate the XML schema for NHibernate on this but I'm not having any luck figuring out how to accomplish the mapping of a list contained within a class in this manner.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload