예제 #1
0
        /// <summary>
        /// Convert DataTable to TableDependencyList object
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static PrimaryColumnDefinitionList ToPrimaryColumnDefinitionList(this DataTable dt)
        {
            var map = new FieldMapperList();

            #region Map Data Column to Property Name
            map.Add("TableName", "TABLE_NAME");
            map.Add("ColumnName", "COLUMN_NAME");
            map.Add("ConstraintName", "CONSTRAINT_NAME");
            map.Add("OrdinalPosition", "ORDINAL_POSITION");
            #endregion
            return(MapFieldToProperty <PrimaryColumnDefinitionList, PrimaryColumnDefinition>(dt, map));
        }
예제 #2
0
        /// <summary>
        /// Convert DataTable to ServiceDefinitionList object
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static ServiceDefinitionList ToServiceDefinitionList(this DataTable dt)
        {
            var map = new FieldMapperList();

            #region Map Data Column to Property Name
            map.Add("ServiceName", "ServerName");
            map.Add("InstanceName", "InstanceName");
            map.Add("IsClustered", "IsClustered");
            map.Add("Version", "Version");
            map.Add("FactoryName", "FactoryName", false);                       // where did FactoryName comes from??????
            #endregion
            return(MapFieldToProperty <ServiceDefinitionList, ServiceDefinition>(dt, map));
        }
예제 #3
0
        /// <summary>
        /// Convert DataTable to TableDefinitionList object
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static TableDefinitionList ToTableDefinitionList(this DataTable dt)
        {
            var map = new FieldMapperList();

            #region Map Data Column to Property Name
            map.Add("Catalog", "TABLE_CATALOG");
            map.Add("Schema", "TABLE_SCHEMA");
            map.Add("TableName", "TABLE_NAME");
            map.Add("TableType", "TABLE_TYPE");

            // for Access database
            map.Add("TableGuid", "TABLE_GUID", false);
            map.Add("Description", "DESCRIPTION", false);
            map.Add("PropertyId", "TABLE_PROPID", false);
            map.Add("Created", "DATE_CREATED", false);
            map.Add("Modified", "DATE_MODIFIED", false);
            #endregion
            return(MapFieldToProperty <TableDefinitionList, TableDefinition>(dt, map));
        }
예제 #4
0
        /// <summary>
        /// Convert DataTable to TableDependencyList object
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static TableDependencyList ToTableDependencyList(this DataTable dt)
        {
            var map = new FieldMapperList();

            #region Map Data Column to Property Name
            map.Add("PrimaryCatalog", "P_TABLE_CATALOG");
            map.Add("PrimarySchema", "P_TABLE_SCHEMA");
            map.Add("PrimaryTableName", "P_TABLE_NAME");
            map.Add("PrimaryColumnName", "P_COLUMN_NAME");
            map.Add("ForeignCatalog", "F_TABLE_CATALOG");
            map.Add("ForeignSchema", "F_TABLE_SCHEMA");
            map.Add("ForeignTableName", "F_TABLE_NAME");
            map.Add("ForeignColumnName", "F_COLUMN_NAME");
            #endregion
            return(MapFieldToProperty <TableDependencyList, TableDependency>(dt, map));
        }
예제 #5
0
        /// <summary>
        /// Convert DataTable to ColumnDefinitionList object
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static ColumnDefinitionList ToColumnDefinitionList(this DataTable dt)
        {
            var map = new FieldMapperList();

            #region Map Data Column to Property Name
            map.Add("Catalog", "TABLE_CATALOG");
            map.Add("Schema", "TABLE_SCHEMA");
            map.Add("TableName", "TABLE_NAME");
            map.Add("ColumnName", "COLUMN_NAME");
            map.Add("Position", "ORDINAL_POSITION");
            map.Add("DefaultValue", "COLUMN_DEFAULT");
            map.Add("IsNullable", "IS_NULLABLE");
            map.Add("DataType", "DATA_TYPE");
            map.Add("CharMaxLength", "CHARACTER_MAXIMUM_LENGTH");
            map.Add("CharOctetLength", "CHARACTER_OCTET_LENGTH");
            map.Add("NumPrecision", "NUMERIC_PRECISION");
            map.Add("NumPrecisionRadix", "NUMERIC_PRECISION_RADIX");
            map.Add("NumScale", "NUMERIC_SCALE");
            map.Add("DatePrecision", "DATETIME_PRECISION");
            map.Add("CharSetCatalog", "CHARACTER_SET_CATALOG");
            map.Add("CharSetSchema", "CHARACTER_SET_SCHEMA");
            map.Add("CharSetName", "CHARACTER_SET_NAME");
            map.Add("CollationCatalog", "COLLATION_CATALOG");
            map.Add("CollationSchema", "COLLATION_SCHEMA");
            map.Add("CollationName", "COLLATION_NAME");
            map.Add("DomainCatalog", "DOMAIN_CATALOG");
            map.Add("DomainSchema", "DOMAIN_SCHEMA");
            map.Add("DomainName", "DOMAIN_NAME");

            // used by Access DB file
            map.Add("ColumnGuid", "COLUMN_GUID", false);
            map.Add("ColumnPropertyId", "COLUMN_PROPID", false);
            map.Add("HasDefault", "COLUMN_HASDEFAULT", false);
            map.Add("ColumnFlags", "COLUMN_FLAGS", false);
            map.Add("TypeGuid", "TYPE_GUID", false);
            map.Add("Description", "DESCRIPTION", false);
            #endregion
            return(MapFieldToProperty <ColumnDefinitionList, ColumnDefinition>(dt, map));
        }
예제 #6
0
        /// <summary>
        /// Convert DataTable to DatabaseDefinitionList object
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static DatabaseDefinitionList ToDatabaseDefinitionList(this DataTable dt)
        {
            var map = new FieldMapperList();

            #region Map Data Column to Property Name
            map.Add("Name", "NAME");
            map.Add("DatabaseId", "DBID");
            map.Add("ServerId", "SID");
            map.Add("Mode", "MODE");
            map.Add("Status", "STATUS");
            map.Add("Status2", "STATUS2");
            map.Add("CreationDate", "CRDATE");
            map.Add("Reserved", "RESERVED");
            map.Add("Category", "CATEGORY");
            map.Add("CompatibilityLevel", "CMPTLEVEL");
            map.Add("Filename", "FILENAME");
            map.Add("Version", "VERSION");

            #endregion
            return(MapFieldToProperty <DatabaseDefinitionList, DatabaseDefinition>(dt, map));
        }