public ObjectField(IFieldPropertyFactory fieldPropertyFactory, FieldAttribute fieldAttribute) { if (fieldAttribute != null && fieldAttribute.SpecificDataType != null) { _specificFieldDefition = fieldPropertyFactory.Create(fieldAttribute.SpecificDataType, fieldAttribute); } }
public SqlDataStore(IDbEngine dbEngine, ISqlFactory sqlFactory) { _dbEngine = dbEngine; _sqlFactory = sqlFactory; _dbAccessStrategy = _sqlFactory.CreateDbAccessStrategy(this); _sqlFieldPropertyFactory = _sqlFactory.CreateFieldPropertyFactory(); _schemaChecker = _sqlFactory.CreateSchemaChecker(this); _connectionPool = new List <IDbConnection>(); ConnectionPoolSize = 20; }
private EntityInfo(IFieldPropertyFactory fieldPropertyFactory, EntityInfoCollection entities, Type entityType) { Fields = new DistinctCollection <Field>(); ForeignKeys = new DistinctCollection <ForeignKey>(); References = new DistinctCollection <Reference>(); Indexes = new DistinctCollection <Index>(); Entities = entities; EntityType = entityType; _attributes = entityType.GetCustomAttributes(true); FieldPropertyFactory = fieldPropertyFactory; }
public static IEntityInfo Create(IFieldPropertyFactory fieldPropertyFactory, EntityInfoCollection entities, Type entityType) { if (entities == null) { throw new ArgumentNullException("entities"); } // already added var entityName = entities.GetNameForType(entityType); if (entityName != null) { return(entities[entityName]); } //TODO: validate NameInStore var result = new EntityInfo(fieldPropertyFactory, entities, entityType); if (result.EntityAttribute == null) { throw new ArgumentException(string.Format("Type '{0}' does not have an EntityAttribute", entityType.Name)); } entities.Add(result); // see if we have any entity // get all field definitions foreach (var prop in GetProperties(entityType)) { result.AnalyseAttribute(prop); } if (result.Fields.Count == 0) { throw new EntityDefinitionException(string.Format("Entity '{0}' Contains no Field definitions.", result.GetNameInStore())); } //Update Reference atribute with new known type foreach (var entityInfo in entities) { var entity = entityInfo as EntityInfo; if (entity == null) { continue; } entity.UpdateRefenceAttribute(); } return(result); }
public virtual void SetUp() { DbPath = GetDbName(); BuildCleanDb(DbPath); FieldPropertyFactory = DataStore.SqlFactory.CreateFieldPropertyFactory(); }