public TableDefinition(
            StorageProviderDefinition storageProviderDefinition,
            EntityNameDefinition tableName,
            EntityNameDefinition viewName,
            ObjectIDStoragePropertyDefinition objectIDProperty,
            IRdbmsStoragePropertyDefinition timestampProperty,
            IEnumerable <IRdbmsStoragePropertyDefinition> dataProperties,
            IEnumerable <ITableConstraintDefinition> constraints,
            IEnumerable <IIndexDefinition> indexes,
            IEnumerable <EntityNameDefinition> synonyms)
            : base(
                storageProviderDefinition,
                viewName,
                objectIDProperty,
                timestampProperty,
                dataProperties,
                indexes,
                synonyms)
        {
            ArgumentUtility.CheckNotNull("tableName", tableName);
            ArgumentUtility.CheckNotNull("constraints", constraints);

            _tableName   = tableName;
            _constraints = constraints.ToList().AsReadOnly();
        }
        public FilterViewDefinition(
            StorageProviderDefinition storageProviderDefinition,
            EntityNameDefinition viewName,
            IRdbmsStorageEntityDefinition baseEntity,
            IEnumerable <string> classIDs,
            ObjectIDStoragePropertyDefinition objectIDProperty,
            IRdbmsStoragePropertyDefinition timestampProperty,
            IEnumerable <IRdbmsStoragePropertyDefinition> dataProperties,
            IEnumerable <IIndexDefinition> indexes,
            IEnumerable <EntityNameDefinition> synonyms)
            : base(
                storageProviderDefinition,
                viewName,
                objectIDProperty,
                timestampProperty,
                dataProperties,
                indexes,
                synonyms)
        {
            ArgumentUtility.CheckNotNull("baseEntity", baseEntity);
            ArgumentUtility.CheckNotNull("classIDs", classIDs);

            var classIDsList = classIDs.ToList().AsReadOnly();

            ArgumentUtility.CheckNotNullOrEmpty("classIDs", classIDsList);

            if (!(baseEntity is TableDefinition || baseEntity is FilterViewDefinition))
            {
                throw new ArgumentException("The base entity must either be a TableDefinition or a FilterViewDefinition.", "baseEntity");
            }

            _baseEntity = baseEntity;
            _classIDs   = classIDsList;
        }
        public ForeignKeyConstraintDefinition CreateForeignKeyConstraint(
            Func <IEnumerable <ColumnDefinition>, string> nameProvider,
            EntityNameDefinition referencedTableName,
            ObjectIDStoragePropertyDefinition referencedObjectIDProperty)
        {
            ArgumentUtility.CheckNotNull("nameProvider", nameProvider);
            ArgumentUtility.CheckNotNull("referencedTableName", referencedTableName);
            ArgumentUtility.CheckNotNull("referencedObjectIDProperty", referencedObjectIDProperty);

            var referencingColumns = ValueProperty.GetColumnsForComparison();
            var referencedColumns  = referencedObjectIDProperty.ValueProperty.GetColumnsForComparison();

            return(new ForeignKeyConstraintDefinition(nameProvider(referencingColumns), referencedTableName, referencingColumns, referencedColumns));
        }
Esempio n. 4
0
        public UnionViewDefinition(
            StorageProviderDefinition storageProviderDefinition,
            EntityNameDefinition viewName,
            IEnumerable <IRdbmsStorageEntityDefinition> unionedEntities,
            ObjectIDStoragePropertyDefinition objectIDProperty,
            IRdbmsStoragePropertyDefinition timestampProperty,
            IEnumerable <IRdbmsStoragePropertyDefinition> dataProperties,
            IEnumerable <IIndexDefinition> indexes,
            IEnumerable <EntityNameDefinition> synonyms)
            : base(
                storageProviderDefinition,
                viewName,
                objectIDProperty,
                timestampProperty,
                dataProperties,
                indexes,
                synonyms)
        {
            ArgumentUtility.CheckNotNull("unionedEntities", unionedEntities);

            var unionedEntitiesList = unionedEntities.ToList().AsReadOnly();

            ArgumentUtility.CheckNotEmpty("unionedEntities", unionedEntitiesList);

            for (int i = 0; i < unionedEntitiesList.Count; ++i)
            {
                var unionedEntity = unionedEntitiesList[i];
                if (!(unionedEntity is TableDefinition || unionedEntity is UnionViewDefinition))
                {
                    throw new ArgumentException(
                              string.Format(
                                  "Item {0} is of type '{1}', but the unioned entities must either be a TableDefinitions or UnionViewDefinitions.",
                                  i,
                                  unionedEntity.GetType()),
                              "unionedEntities");
                }
            }

            _unionedEntities = unionedEntitiesList;
        }
Esempio n. 5
0
        protected RdbmsStorageEntityDefinitionBase(
            StorageProviderDefinition storageProviderDefinition,
            EntityNameDefinition viewName,
            ObjectIDStoragePropertyDefinition objectIDProperty,
            IRdbmsStoragePropertyDefinition timestampProperty,
            IEnumerable <IRdbmsStoragePropertyDefinition> dataProperties,
            IEnumerable <IIndexDefinition> indexes,
            IEnumerable <EntityNameDefinition> synonyms)
        {
            ArgumentUtility.CheckNotNull("storageProviderDefinition", storageProviderDefinition);
            ArgumentUtility.CheckNotNull("objectIDProperty", objectIDProperty);
            ArgumentUtility.CheckNotNull("timestampProperty", timestampProperty);
            ArgumentUtility.CheckNotNull("dataProperties", dataProperties);
            ArgumentUtility.CheckNotNull("synonyms", synonyms);

            _storageProviderDefinition = storageProviderDefinition;
            _viewName = viewName;

            _objectIDProperty  = objectIDProperty;
            _timestampProperty = timestampProperty;
            _dataProperties    = dataProperties.ToList().AsReadOnly();
            _indexes           = indexes.ToList().AsReadOnly();
            _synonyms          = synonyms.ToList().AsReadOnly();
        }
        public ForeignKeyConstraintDefinition CreateForeignKeyConstraint(Func <IEnumerable <ColumnDefinition>, string> nameProvider, EntityNameDefinition referencedTableName, ObjectIDStoragePropertyDefinition referencedObjectIDProperty)
        {
            ArgumentUtility.CheckNotNull("nameProvider", nameProvider);
            ArgumentUtility.CheckNotNull("referencedTableName", referencedTableName);
            ArgumentUtility.CheckNotNull("referencedObjectIDProperty", referencedObjectIDProperty);

            throw new NotSupportedException("String-serialized ObjectID values cannot be used as foreign keys.");
        }