Пример #1
0
 /// <summary>
 /// 删除视图。
 /// </summary>
 /// <param name="type">指定对象类型。</param>
 /// <param name="name">操作对象名称。</param>
 /// <returns>操作实例。</returns>
 public DbMaintenanceOperateBase DropView(Type type, DbName name = null)
 {
     if (name == null)
     {
         var View = _Metadata.Table(type);
         name = DbName.Create(View.Name, View.Schema);
     }
     return(new DbDropObjectOperate(_Context, type, EOperateType.DropView, name));
 }
Пример #2
0
 /// <summary>
 /// 创建视图。
 /// </summary>
 /// <param name="type">指定对象类型。</param>
 /// <param name="content">视图内容。</param>
 /// <param name="name">指定视图名。</param>
 /// <returns>操作实例。</returns>
 public DbMaintenanceOperateBase CreateView(Type type, string content, DbName name = null)
 {
     if (name == null)
     {
         var table = _Metadata.Table(type);
         name = DbName.Create(table.Name, table.Schema);
     }
     return(new DbCreateViewOperate(_Context, type, name, content));
 }
Пример #3
0
 /// <summary>
 /// 创建视图。
 /// </summary>
 /// <param name="type">指定对象类型。</param>
 /// <param name="query">查询内容。</param>
 /// <param name="name">指定视图名。</param>
 /// <returns>操作实例。</returns>
 public DbMaintenanceOperateBase CreateView(Type type, IQueryable query, DbName name = null)
 {
     if (name == null)
     {
         var table = _Metadata.Table(type);
         name = DbName.Create(table.Name, table.Schema);
     }
     return(new DbCreateViewOperate(_Context, type, name, query.Expression));
 }
Пример #4
0
 /// <summary>
 /// 重命名数据表。
 /// </summary>
 /// <param name="type">指定对象类型。</param>
 /// <param name="newName">操作对象名称。</param>
 /// <param name="name">操作对象名称。</param>
 /// <returns>操作实例。</returns>
 public DbMaintenanceOperateBase RenameTable(Type type, string newName, DbName name = null)
 {
     if (name == null)
     {
         var table = _Metadata.Table(type);
         name = DbName.Create(table.Name, table.Schema);
     }
     return(new DbRenameObjectOperate(_Context, type, EOperateType.RenameTable, name, newName));
 }
Пример #5
0
 /// <summary>
 /// 判断指定的数据表是否存在。
 /// </summary>
 /// <param name="type">指定对象类型。</param>
 /// <param name="name">操作对象名称。</param>
 /// <returns>操作实例。</returns>
 public DbMaintenanceOperateBase TableIsExsit(Type type, DbName name = null)
 {
     if (name == null)
     {
         var table = _Metadata.Table(type);
         name = DbName.Create(table.Name, table.Schema);
     }
     return(new DbObjectIsExsitOperate(_Context, type, EOperateType.TableIsExsit, name));
 }
Пример #6
0
 /// <summary>
 /// 判断指定的数据表是否存在。
 /// </summary>
 /// <typeparam name="T">映射的对象类型。</typeparam>
 /// <param name="name">表名。</param>
 /// <param name="schema">架构名。</param>
 /// <returns>操作实例。</returns>
 public DbMaintenanceOperateBase TableIsExsit <T>(string name = "", string schema = "")
 {
     if (name == "")
     {
         return(TableIsExsit(typeof(T)));
     }
     else
     {
         return(TableIsExsit(typeof(T), DbName.Create(name, schema)));
     }
 }
Пример #7
0
 /// <summary>
 /// 删除视图。
 /// </summary>
 /// <typeparam name="T">映射的对象类型。</typeparam>
 /// <param name="name">视图名。</param>
 /// <param name="schema">架构名。</param>
 /// <returns>操作实例。</returns>
 public DbMaintenanceOperateBase DropView <T>(string name = "", string schema = "")
 {
     if (name == "")
     {
         return(DropView(typeof(T)));
     }
     else
     {
         return(DropView(typeof(T), DbName.Create(name, schema)));
     }
 }
Пример #8
0
 /// <summary>
 /// 创建视图。
 /// </summary>
 /// <typeparam name="T">指定对象类型。</typeparam>
 /// <param name="query">查询内容。</param>
 /// <param name="name">视图名。</param>
 /// <param name="schema">架构名。</param>
 /// <returns>操作实例。</returns>
 public DbMaintenanceOperateBase CreateView <T>(IQueryable <T> query, string name = "", string schema = "")
 {
     if (name == "")
     {
         return(CreateView(typeof(T), query));
     }
     else
     {
         return(CreateView(typeof(T), query, DbName.Create(name, schema)));
     }
 }
Пример #9
0
 /// <summary>
 /// 删除数据表。
 /// </summary>
 /// <typeparam name="T">映射的对象类型。</typeparam>
 /// <param name="newName">操作对象名称。</param>
 /// <param name="name">表名。</param>
 /// <param name="schema">架构名。</param>
 /// <returns>操作实例。</returns>
 public DbMaintenanceOperateBase RenameTable <T>(string newName, string name = "", string schema = "")
 {
     if (name == "")
     {
         return(RenameTable(typeof(T), newName));
     }
     else
     {
         return(RenameTable(typeof(T), newName, DbName.Create(name, schema)));
     }
 }
Пример #10
0
 /// <summary>
 /// 创建数据表变量。
 /// </summary>
 /// <param name="type">指定对象类型。</param>
 /// <param name="name">指定表名。</param>
 /// <returns>操作实例。</returns>
 public DbMaintenanceOperateBase CreateTableVariable(Type type, string name)
 {
     return(new DbCreateTableOperate(_Context, type, EOperateType.CreateTableVariable, DbName.Contact(name)));
 }