static MappingRepo()
        {
            var map = MappingRepoDictionary.GetMap <T>();

            if (map != null)
            {
                Map = map;
                return;
            }

            var classMapBase = typeof(ClassMap <T>).GetTypeInfo();

            Map = typeof(T)
                  .GetTypeInfo()
                  .Assembly
                  .ExportedTypes
                  .Where(x => classMapBase.IsAssignableFrom(x.GetTypeInfo().BaseType?.GetTypeInfo()))
                  .Select(x => (ClassMap <T>)Activator.CreateInstance(x))
                  .FirstOrDefault();
        }
Example #2
0
 public CompositeId(ClassMap <T> classMap)
 {
     ClassMap = classMap;
 }