コード例 #1
0
ファイル: InfoFactory.cs プロジェクト: Seddryck/Tibre
        public Info Build(string name, IEnumerable<TSqlColumn> fieldColumns)
        {
            var tableName = new ObjectIdentifier(new string[] { "dwh", name + "Info" });
            var identity = new IdentityFactory().Build(name + "Info" + "Id");

            var info = new Info()
            {
                Name = tableName,
                Identity = identity,
                Fields = new List<TSqlColumn>(fieldColumns)
            };

            return info;
        }
コード例 #2
0
ファイル: AnchorFactory.cs プロジェクト: Seddryck/Tibre
        public Anchor Build(string schema, string name, IEnumerable<TSqlColumn> businessKeyColumns)
        {
            var tableName = new ObjectIdentifier(new string[] { schema, name });

            var identityFactory = new IdentityFactory();
            var identity = identityFactory.Build(name + "Id");

            var anchor = new Anchor()
            {
                Name = tableName,
                Identity = identity,
                BusinessKey = new List<TSqlColumn>(businessKeyColumns)
            };

            return anchor;
        }
コード例 #3
0
ファイル: InfoFactory.cs プロジェクト: Seddryck/Tibre
        public Info Build(string schema, string name, string suffix, Tuple<string, string> key, IEnumerable<Tuple<string, string>> fields)
        {
            var tableName = new ObjectIdentifier(new string[] { schema, name + suffix });
            var identity = new IdentityFactory().Build(name + suffix + "Id");
            var fieldColumns = new List<TSqlColumn>();

            var sqlDataTypeFactory = new TSqlDataTypeFactory();
            var columnFactory = new ColumnFactory();

            TSqlDataType sqlDataType;
            TSqlColumn keyColumn = null;

            if (key!=null)
            {
                sqlDataType = sqlDataTypeFactory.Build(key.Item2);
                keyColumn = columnFactory.Build(key.Item1, sqlDataType);
            }

            foreach (var field in fields)
            {
                var fieldName = field.Item1;

                sqlDataType = sqlDataTypeFactory.Build(field.Item2);
                var column = columnFactory.Build(fieldName, sqlDataType);
                fieldColumns.Add(column);
            }

            var info = new Info()
            {
                Name = tableName,
                Identity = identity,
                Fields = fieldColumns
            };

            return info;
        }