private Type GetEntityType(Persistence.IEntityType entityType) { if (cachedEntityTypes.TryGetValue(entityType.Id, out Type type) == false) { type = this.ExtractEntityType(entityType); cachedEntityTypes.Add(entityType.Id, type); } return(type); }
public EntityType( Persistence.IEntityType entityType, IExternalSystem destinationSystem, IEnumerable <IExternalSystem> sharedIdentifierSourceSystems) { this.entityType = entityType; this.destinationSystem = destinationSystem; this.type = this.GetEntityType(entityType); this.sharedIdentifierSourceSystems = sharedIdentifierSourceSystems; }
private Type ExtractEntityType(Persistence.IEntityType entityType) { try { return (AppDomain .CurrentDomain .GetAssemblies() .Where(assembly => assembly.IsDynamic == false) .SelectMany(assembly => assembly.ExportedTypes) .Single(type => type.AssemblyQualifiedName == entityType.TypeName)); } catch { throw new InvalidOperationException(string.Format( Resources.InvalidEntityType, entityType.Name, entityType.TypeName)); } }