• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TableInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TableInfo的典型用法代码示例。如果您正苦于以下问题:C# TableInfo类的具体用法?C# TableInfo怎么用?C# TableInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TableInfo类属于命名空间,在下文中一共展示了TableInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TableQueryInfo

 public TableQueryInfo(IUserSession session, TableInfo tableInfo, ObjectName tableName, ObjectName aliasName)
 {
     Session = session;
     TableInfo = tableInfo;
     TableName = tableName;
     AliasName = aliasName;
 }
开发者ID:furesoft,项目名称:deveeldb,代码行数:7,代码来源:UserSessionExtensions.cs


示例2: SessionTableContainer

        static SessionTableContainer()
        {
            // SYSTEM.OPEN_SESSIONS
            OpenSessionsTableInfo = new TableInfo(SystemSchema.OpenSessionsTableName);
            OpenSessionsTableInfo.AddColumn("username", PrimitiveTypes.String());
            OpenSessionsTableInfo.AddColumn("host_string", PrimitiveTypes.String());
            OpenSessionsTableInfo.AddColumn("last_command", PrimitiveTypes.DateTime());
            OpenSessionsTableInfo.AddColumn("time_connected", PrimitiveTypes.DateTime());
            OpenSessionsTableInfo = OpenSessionsTableInfo.AsReadOnly();

            // SYSTEM.SESSION_INFO
            SessionInfoTableInfo = new TableInfo(SystemSchema.SessionInfoTableName);
            SessionInfoTableInfo.AddColumn("var", PrimitiveTypes.String());
            SessionInfoTableInfo.AddColumn("value", PrimitiveTypes.String());
            SessionInfoTableInfo = SessionInfoTableInfo.AsReadOnly();

            // SYSTEM.STATS
            StatisticsTableInfo = new TableInfo(SystemSchema.StatisticsTableName);
            StatisticsTableInfo.AddColumn("stat_name", PrimitiveTypes.String());
            StatisticsTableInfo.AddColumn("value", PrimitiveTypes.String());
            StatisticsTableInfo = StatisticsTableInfo.AsReadOnly();

            IntTableInfo = new TableInfo[3];
            IntTableInfo[0] = StatisticsTableInfo;
            IntTableInfo[1] = SessionInfoTableInfo;
            IntTableInfo[2] = OpenSessionsTableInfo;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:27,代码来源:SessionTableContainer.cs


示例3: Create

        public void Create()
        {
            // SYSTEM.ROUTINE
            var tableInfo = new TableInfo(SystemSchema.RoutineTableName);
            tableInfo.AddColumn("schema", PrimitiveTypes.String());
            tableInfo.AddColumn("name", PrimitiveTypes.String());
            tableInfo.AddColumn("type", PrimitiveTypes.String());
            tableInfo.AddColumn("location", PrimitiveTypes.String());
            tableInfo.AddColumn("return_type", PrimitiveTypes.String());
            tableInfo.AddColumn("username", PrimitiveTypes.String());
            transaction.CreateTable(tableInfo);

            // SYSTEM.ROUTINE_PARAM
            tableInfo = new TableInfo(SystemSchema.RoutineParameterTableName);
            tableInfo.AddColumn("schema", PrimitiveTypes.String());
            tableInfo.AddColumn("name", PrimitiveTypes.String());
            tableInfo.AddColumn("arg_name", PrimitiveTypes.String());
            tableInfo.AddColumn("arg_type", PrimitiveTypes.String());
            tableInfo.AddColumn("in_out", PrimitiveTypes.String());
            tableInfo.AddColumn("offset", PrimitiveTypes.Integer());
            transaction.CreateTable(tableInfo);

            var fkCol = new[] {"routine_schema", "routine_name"};
            var refCol = new[] {"schema", "name"};
            const ForeignKeyAction onUpdate = ForeignKeyAction.NoAction;
            const ForeignKeyAction onDelete = ForeignKeyAction.Cascade;

            transaction.AddForeignKey(SystemSchema.RoutineParameterTableName, fkCol, SystemSchema.RoutineTableName, refCol,
                onDelete, onUpdate, "ROUTINE_PARAMS_FK");
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:30,代码来源:RoutineManager.cs


示例4: GetAutoIncrementExpression

		public override string GetAutoIncrementExpression(TableInfo ti)
		{
			if (!string.IsNullOrEmpty(ti.SequenceName))
				return string.Format("{0}.nextval", ti.SequenceName);

			return null;
		}
开发者ID:bamboo82,项目名称:AsyncPoco,代码行数:7,代码来源:OracleDatabaseType.cs


示例5: TestSetup

        public void TestSetup()
        {
            var tableInfo = new TableInfo(ObjectName.Parse("APP.people"));
            tableInfo.AddColumn("id", PrimitiveTypes.Bit());
            tableInfo.AddColumn("first_name", PrimitiveTypes.String(), true);
            tableInfo.AddColumn("last_name", PrimitiveTypes.String());
            tableInfo.AddColumn("age", PrimitiveTypes.TinyInt());
            table = new TemporaryTable(tableInfo);

            var tempTable = (TemporaryTable) table;
            tempTable.NewRow(new[] {
                DataObject.BigInt(1),
                DataObject.String("Antonello"),
                DataObject.String("Provenzano"),
                DataObject.Null()
            });
            tempTable.NewRow(new[] {
                DataObject.BigInt(2),
                DataObject.String("Moritz"),
                DataObject.String("Krull"),
                DataObject.TinyInt(31)
            });

            tempTable.BuildIndexes();
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:25,代码来源:TableQueryTests.cs


示例6: CreateAdminSession

        protected override ISession CreateAdminSession(IDatabase database)
        {
            using (var session = base.CreateAdminSession(database)) {
                using (var query = session.CreateQuery()) {
                    var tn1 = ObjectName.Parse("APP.test_table1");
                    var tableInfo1 = new TableInfo(tn1);
                    tableInfo1.AddColumn(new ColumnInfo("id", PrimitiveTypes.Integer()));
                    tableInfo1.AddColumn(new ColumnInfo("name", PrimitiveTypes.String()));
                    tableInfo1.AddColumn(new ColumnInfo("date", PrimitiveTypes.DateTime()));
                    query.CreateTable(tableInfo1);
                    query.AddPrimaryKey(tn1, "id");

                    var tn2 = ObjectName.Parse("APP.test_table2");
                    var tableInfo2 = new TableInfo(tn2);
                    tableInfo2.AddColumn(new ColumnInfo("id", PrimitiveTypes.Integer()));
                    tableInfo2.AddColumn(new ColumnInfo("other_id", PrimitiveTypes.Integer()));
                    tableInfo2.AddColumn(new ColumnInfo("count", PrimitiveTypes.Integer()));
                    query.CreateTable(tableInfo2);
                    query.AddPrimaryKey(tn2, "id");
                    query.AddForeignKey(tn2, new[] { "other_id" }, tn1, new[] { "id" }, ForeignKeyAction.Cascade, ForeignKeyAction.Cascade, null);

                    query.Commit();
                }
            }

            return base.CreateAdminSession(database);
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:27,代码来源:DropTableTests.cs


示例7: DoRun

        protected override void DoRun()
        {
            var tables = Connection.GetSchema("Tables");
            var columns = new List<DataRow>();
            foreach (DataRow row in Connection.GetSchema("Columns").Rows) columns.Add(row);
            columns = new List<DataRow>(columns.SortedByKey<DataRow, int>(c => c.SafeInt("ORDINAL_POSITION")));

            foreach (DataRow row in tables.Rows)
            {
                if (row.SafeString("TABLE_TYPE") != "BASE TABLE") continue;
                var table = new TableInfo(Result);
                table.FullName = new NameWithSchema(row.SafeString("TABLE_SCHEMA"), row.SafeString("TABLE_NAME"));
                Result.Tables.Add(table);
                _tables[table.FullName] = table;
            }

            foreach (DataRow row in columns)
            {
                if (row.SafeString("TABLE_TYPE") != "BASE TABLE") continue;
                var tname = new NameWithSchema(row.SafeString("TABLE_SCHEMA"), row.SafeString("TABLE_NAME"));
                var table = _tables[tname];
                var col = new ColumnInfo(table);
                col.Name = row.SafeString("COLUMN_NAME");
                col.NotNull = row.SafeString("IS_NULLABLE") == "NO";
                col.DataType = row.SafeString("DATA_TYPE");
                col.Length = row.SafeInt("CHARACTER_MAXIMUM_LENGTH");
                col.Precision = row.SafeInt("NUMERIC_PRECISION");
                col.Scale = row.SafeInt("NUMERIC_SCALE");
                col.DefaultValue = row.SafeString("COLUMN_DEFAULT");
                table.Columns.Add(col);
            }
        }
开发者ID:dbshell,项目名称:dbshell,代码行数:32,代码来源:DatabaseAnalyser.cs


示例8: CreateSimpleTableAsAdmin

        public void CreateSimpleTableAsAdmin()
        {
            var tableName = ObjectName.Parse("APP.test_table");
            var tableInfo = new TableInfo(tableName);
            tableInfo.AddColumn("a", PrimitiveTypes.Integer(), true);
            tableInfo.AddColumn("b", PrimitiveTypes.String());

            using (var session = Database.CreateUserSession(AdminUserName, AdminPassword)) {
                using (var context = new SessionQueryContext(session)) {
                    Assert.DoesNotThrow(() => {
                        context.CreateTable(tableInfo);
                    });
                }

                Assert.DoesNotThrow(() => session.Commit());
            }

            using (var session = Database.CreateUserSession(AdminUserName, AdminPassword)) {
                using (var context = new SessionQueryContext(session)) {
                    bool exists = false;
                    Assert.DoesNotThrow(() => exists = context.TableExists(tableName));
                    Assert.IsTrue(exists);
                }
            }
        }
开发者ID:prepare,项目名称:deveeldb,代码行数:25,代码来源:TableTests.cs


示例9: GetTableInfo

    internal static TableInfo GetTableInfo( Type t )
    {
      TableInfo table;
      if ( _tableNameCache.TryGetValue( t, out table ) ) return table;

      table = new TableInfo();
      table.TableName = t.Name;
      table.SchemaName = "dbo";

      // check for an attribute specifying something different
      var tableAttribute = t.GetCustomAttribute<TableAttribute>( false );
      if ( tableAttribute != null )
      {
        table.TableName = tableAttribute.Name;
        if ( !string.IsNullOrWhiteSpace( tableAttribute.Schema ) ) table.SchemaName = tableAttribute.Schema;
      }

      // get the property names that can be mapped
      foreach ( var pi in t.GetProperties( System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public ).Where( m => m.CanRead && m.CanWrite && !m.HasCustomAttribute<NotMappedAttribute>( false ) ) )
        table.FieldNames.Add( GetFieldName( pi ) );

      // get the key property names
      foreach ( var pi in t.GetProperties( System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public ).Where( m => m.CanRead && m.CanWrite && m.HasCustomAttribute<System.ComponentModel.DataAnnotations.KeyAttribute>( false )  ) )
        table.PrimaryKeyFieldNames.Add( GetFieldName( pi ) );

      // try to add the newly aquired info
      if ( _tableNameCache.TryAdd( t, table ) ) return table;
      return _tableNameCache[ t ];
    }
开发者ID:lcslima,项目名称:Dapper.Contrib.Linq.PostgreSQL,代码行数:29,代码来源:DapperSqlBuilder_ReflectionCache.cs


示例10: CreateObjectInfo

        public IObjectInfo CreateObjectInfo(Type forType)
        {
            if (forType == null)
            {
                throw new ArgumentNullException("forType");
            }

            var tableAttribute = forType.GetAttribute<TableAttribute>(inherit: false);

            if (tableAttribute == null)
            {
                throw new MappingException(ExceptionMessages.AttributeMappingConvention_NoTableAttribute.FormatWith(forType.FullName));
            }

            var identifierStrategy = IdentifierStrategy.DbGenerated;
            var columns = this.CreateColumnInfos(forType, ref identifierStrategy);

            var tableInfo = new TableInfo(columns, identifierStrategy, tableAttribute.Name, tableAttribute.Schema);

            if (this.log.IsDebug)
            {
                this.log.Debug(LogMessages.MappingConvention_MappingTypeToTable, forType.FullName, tableInfo.Schema, tableInfo.Name);
            }

            return new PocoObjectInfo(forType, tableInfo);
        }
开发者ID:natarajanmca11,项目名称:MicroLite,代码行数:26,代码来源:AttributeMappingConvention.cs


示例11: GetDeleteByIdSql

        public static string GetDeleteByIdSql(TableInfo tableInfo)
        {
            string strSql = "delete from {0} where {1} =" + AdoHelper.DbParmChar + tableInfo.Id.Key;
            strSql = string.Format(strSql, tableInfo.TableName, tableInfo.Id.Key);

            return strSql;
        }
开发者ID:sndnvaps,项目名称:easy4net,代码行数:7,代码来源:DbEntityUtils.cs


示例12: CreateTable

 private void CreateTable(IQuery query)
 {
     var tableInfo = new TableInfo(ObjectName.Parse("APP.test_table"));
     tableInfo.AddColumn("a", PrimitiveTypes.Integer());
     tableInfo.AddColumn("b", PrimitiveTypes.String(), false);
     query.CreateTable(tableInfo, false, false);
 }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:7,代码来源:OpenStatementTests.cs


示例13: OnSetUp

        protected override bool OnSetUp(string testName, IQuery query)
        {
            var tableInfo = new TableInfo(ObjectName.Parse("APP.test_table"));
            tableInfo.AddColumn("a", PrimitiveTypes.Integer());

            query.Access().CreateObject(tableInfo);
            return true;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:8,代码来源:RefTypesTests.cs


示例14: TableInfoListViewItem

        public TableInfoListViewItem(TableInfo table)
        {
            this.Table = table;
            if (table == null) return;

            this.Name = table.Name;
            this.Text = $"{table.Name} ({table.TotalRecords})";
        }
开发者ID:baoduy,项目名称:DataMigrationScriptGeneration,代码行数:8,代码来源:TableInfoListViewItem.cs


示例15: IsTableDropped

 private bool IsTableDropped(IEnumerable<RelationalModelChange> changes, TableInfo table)
 {
     return CollectionUtils.Contains(changes,
         delegate(RelationalModelChange c)
         {
             return c is DropTableChange && Equals(c.Table, table);
         });
 }
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:8,代码来源:MsSqlRenderer.cs


示例16: GetTableInfo

 public void GetTableInfo(Type t, TableInfo ti)
 {
     if (t == typeof(Poco2))
     {
         ti.TableName = "petapoco";
         ti.PrimaryKey = "id";
     }
 }
开发者ID:sdhjl2000,项目名称:PetaPoco,代码行数:8,代码来源:ColumnMapper.cs


示例17: ForeignKeyBuilder

        public ForeignKeyBuilder(string name, TableInfo referencedTable)
            : base(name)
        {
            targetTable = referencedTable.Name;
              targetColName = referencedTable.PrimaryKeyName;

              base.colType = referencedTable.PrimaryKeyType;
              base.size = referencedTable.PrimaryKeySize;
        }
开发者ID:simonlaroche,项目名称:machine,代码行数:9,代码来源:ForeignKeyBuilder.cs


示例18: FunctionTable

        public FunctionTable(ITable table, SqlExpression[] functionList, string[] columnNames, IRequest queryContext)
            : base(queryContext.Context)
        {
            // Make sure we are synchronized over the class.
            lock (typeof(FunctionTable)) {
                uniqueId = uniqueKeySeq;
                ++uniqueKeySeq;
            }

            uniqueId = (uniqueId & 0x0FFFFFFF) | 0x010000000;

            context = queryContext;

            ReferenceTable = table;
            varResolver = table.GetVariableResolver();
            varResolver = varResolver.ForRow(0);

            // Create a DataTableInfo object for this function table.
            funTableInfo = new TableInfo(FunctionTableName);

            expList = new SqlExpression[functionList.Length];
            expInfo = new byte[functionList.Length];

            // Create a new DataColumnInfo for each expression, and work out if the
            // expression is simple or not.
            for (int i = 0; i < functionList.Length; ++i) {
                var expr = functionList[i];
                // Examine the expression and determine if it is simple or not
                if (expr.IsConstant() && !expr.HasAggregate(context)) {
                    // If expression is a constant, solve it
                    var result = expr.Evaluate(context, null);
                    if (result.ExpressionType != SqlExpressionType.Constant)
                        throw new InvalidOperationException();

                    expr = result;
                    expList[i] = expr;
                    expInfo[i] = 1;
                } else {
                    // Otherwise must be dynamic
                    expList[i] = expr;
                    expInfo[i] = 0;
                }

                // Make the column info
                funTableInfo.AddColumn(columnNames[i], expr.ReturnType(context, varResolver));
            }

            // Make sure the table info isn't changed from this point on.
            funTableInfo = funTableInfo.AsReadOnly();

            // routine tables are the size of the referring table.
            rowCount = table.RowCount;

            // Set schemes to 'blind search'.
            SetupIndexes(DefaultIndexTypes.BlindSearch);
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:56,代码来源:FunctionTable.cs


示例19: Ctor_Sets_JsonConverter_And_TableInfo

        public void Ctor_Sets_JsonConverter_And_TableInfo()
        {
            var jsonConverter = new JilJsonConverter();
            var info = new TableInfo();

            var convention = new StoreConventions(jsonConverter, info);

            convention.JsonConverter.ShouldBeSameAs(jsonConverter);
            convention.TableInfo.ShouldBeSameAs(info);
        }
开发者ID:YoloDev,项目名称:elephanet,代码行数:10,代码来源:StoreConventionsTests.cs


示例20: CreateQuery

 protected override IQuery CreateQuery(ISession session)
 {
     var query = base.CreateQuery(session);
     var tableInfo = new TableInfo(TestTableName);
     tableInfo.AddColumn("id", PrimitiveTypes.Integer());
     tableInfo.AddColumn("name", PrimitiveTypes.String());
     tableInfo.AddColumn("date", PrimitiveTypes.DateTime());
     query.CreateTable(tableInfo);
     return query;
 }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:10,代码来源:TriggerTests.cs



注:本文中的TableInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TableName类代码示例发布时间:2022-05-24
下一篇:
C# TableIndex类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap