Exemple #1
0
        private Type GetTypeDyctionaryEntityNames(IPropertyMapping property, bool isOwnerType = false)
        {
            var entityType = property.EntityMapping.EntityType.GetTypeInfo();
            DictionaryEntityNames entityName;
            Assembly mappingAssembly;

            if (_assemblyCache.TryGetValue(entityType.Assembly, out mappingAssembly))
            {
                entityName = new DictionaryEntityNames(
                    entityType.Namespace,
                    entityType.Name,
                    property.Name,
                    mappingAssembly.FullName);
            }
            else
            {
                entityName = new TypeDictionaryEntityNames(property.EntityMapping.EntityType.GetTypeInfo().GetProperty(property.Name));
                if (Type.GetType(entityName.EntryTypeFullyQualifiedName, false) != null)
                {
                    _assemblyCache[entityType.Assembly] = mappingAssembly = entityType.Assembly;
                }
                else
                {
                    _assemblyCache[entityType.Assembly] = mappingAssembly = _emitHelper.GetDynamicModule().Assembly;
                    entityName = new DictionaryEntityNames(
                        entityType.Namespace,
                        entityType.Name,
                        property.Name,
                        mappingAssembly.FullName);
                }
            }

            return(mappingAssembly.GetType(isOwnerType ? entityName.FullOwnerTypeName : entityName.FullEntryTypeName));
        }
 public void Setup()
 {
     _names = new DictionaryEntityNamesTestable("RomanticWeb.Tests", "ITestEntity", "SomeProperty", "The.Assembly");
 }