Browse Source

-

pull/12/MERGE
sunkaixuan 7 years ago
parent
commit
1c3ba6eb84
  1. 12
      Src/Asp.Net/OracleTest/Demos/5_DbFirst.cs
  2. 29
      Src/Asp.Net/SqlSugar/Realization/Oracle/DbMaintenance/OracleDbMaintenance.cs

12
Src/Asp.Net/OracleTest/Demos/5_DbFirst.cs

@ -12,28 +12,28 @@ namespace OrmTest.Demo
{
var db = GetInstance();
//Create all class
db.DbFirst.CreateClassFile("c:\\Demo\\1");
db.DbFirst.CreateClassFile("c:\\DemoOracle\\1");
//Create student calsss
db.DbFirst.Where("Student").CreateClassFile("c:\\Demo\\2");
db.DbFirst.Where("Student").CreateClassFile("c:\\DemoOracle\\2");
//Where(array)
//Mapping name
db.MappingTables.Add("ClassStudent", "Student");
db.MappingColumns.Add("NewId", "Id", "ClassStudent");
db.DbFirst.Where("Student").CreateClassFile("c:\\Demo\\3");
db.DbFirst.Where("Student").CreateClassFile("c:\\DemoOracle\\3");
//Remove mapping
db.MappingTables.Clear();
//Create class with default value
db.DbFirst.IsCreateDefaultValue().CreateClassFile("c:\\Demo\\4", "Demo.Models");
db.DbFirst.IsCreateDefaultValue().CreateClassFile("c:\\DemoOracle\\4", "DemoOracle.Models");
//Mapping and Attribute
db.MappingTables.Add("ClassStudent", "Student");
db.MappingColumns.Add("NewId", "Id", "ClassStudent");
db.DbFirst.IsCreateAttribute().Where("Student").CreateClassFile("c:\\Demo\\5");
db.DbFirst.IsCreateAttribute().Where("Student").CreateClassFile("c:\\DemoOracle\\5");
//Remove mapping
@ -66,7 +66,7 @@ namespace OrmTest.Demo
{
return old;
})
.CreateClassFile("c:\\Demo\\6");
.CreateClassFile("c:\\DemoOracle\\6");
}
}
}

29
Src/Asp.Net/SqlSugar/Realization/Oracle/DbMaintenance/OracleDbMaintenance.cs

@ -14,25 +14,38 @@ namespace SqlSugar
{
get
{
return null;
throw new NotSupportedException();
}
}
protected override string GetTableInfoListSql
{
get
{
return @"SELECT s.Name,Convert(varchar(max),tbp.value) as Description
FROM sysobjects s
LEFT JOIN sys.extended_properties as tbp ON s.id=tbp.major_id and tbp.minor_id=0 WHERE s.xtype IN('U') AND (tbp.Name='MS_Description' OR tbp.Name is null)";
return @"SELECT table_name name from user_tables where
table_name!='HELP'
AND table_name NOT LIKE '%$%'
AND table_name NOT LIKE 'LOGMNRC_%'
AND table_name!='LOGMNRP_CTAS_PART_MAP'
AND table_name!='LOGMNR_LOGMNR_BUILDLOG'
AND table_name!='SQLPLUS_PRODUCT_PROFILE'
UNION all
select view_name name from user_views
WHERE VIEW_name NOT LIKE '%$%'
AND VIEW_NAME !='PRODUCT_PRIVS'
AND VIEW_NAME NOT LIKE 'MVIEW_%' ";
}
}
protected override string GetViewInfoListSql
{
get
{
return @"SELECT s.Name,Convert(varchar(max),tbp.value) as Description
FROM sysobjects s
LEFT JOIN sys.extended_properties as tbp ON s.id=tbp.major_id and tbp.minor_id=0 WHERE s.xtype IN('V') AND (tbp.Name='MS_Description' OR tbp.Name is null)";
return @"SELECT table_name name from user_tables where
table_name != 'HELP'
AND table_name NOT LIKE '%$%'
AND table_name NOT LIKE 'LOGMNRC_%'
AND table_name!= 'LOGMNRP_CTAS_PART_MAP'
AND table_name!= 'LOGMNR_LOGMNR_BUILDLOG'
AND table_name!= 'SQLPLUS_PRODUCT_PROFILE'";
}
}
#endregion
@ -129,7 +142,7 @@ namespace SqlSugar
{
get
{
return "select top 1 id from sysobjects";
return "select t.table_name from user_tables t where rownum=1";
}
}
#endregion

Loading…
Cancel
Save