diff --git a/UCsoft.Dao/Properties/AssemblyInfo.cs b/UCsoft.Dao/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ca66733 --- /dev/null +++ b/UCsoft.Dao/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("UCsoft.Dao")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("UCsoft.Dao")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("293f7bcd-dfeb-4061-bafc-2849c6a67b81")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/UCsoft.Dao/UCsoft.Dao.csproj b/UCsoft.Dao/UCsoft.Dao.csproj new file mode 100644 index 0000000..51403ae --- /dev/null +++ b/UCsoft.Dao/UCsoft.Dao.csproj @@ -0,0 +1,52 @@ + + + + + Debug + AnyCPU + {A82D0328-3BF9-4798-AF81-1B0510DF316A} + Library + Properties + UCsoft.Dao + UCsoft.Dao + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/UCsoft.Service/Properties/AssemblyInfo.cs b/UCsoft.Service/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8be60fe --- /dev/null +++ b/UCsoft.Service/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("UCsoft.Service")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("UCsoft.Service")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("35b4cf8f-8c82-4491-931b-6e654794126e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/UCsoft.Service/UCsoft.Service.csproj b/UCsoft.Service/UCsoft.Service.csproj new file mode 100644 index 0000000..7972c29 --- /dev/null +++ b/UCsoft.Service/UCsoft.Service.csproj @@ -0,0 +1,52 @@ + + + + + Debug + AnyCPU + {46D66FFD-2EE6-488C-8F9A-7507BF108014} + Library + Properties + UCsoft.Service + UCsoft.Service + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/UCsoft.T4/Data/DBContext.cs b/UCsoft.T4/Data/DBContext.cs deleted file mode 100644 index 1fd7c2e..0000000 --- a/UCsoft.T4/Data/DBContext.cs +++ /dev/null @@ -1,73 +0,0 @@ - -/* - * ======================================================================== - * Copyright(c) 2013-2014 郑州优创科技有限公司, All Rights Reserved. - * ======================================================================== - * - * 【Ed数据库操作上下文】 - * - * - * 作者:唐有炜 时间:2014-11-05 16:29:42 - * 文件名:@dbContextName - * 版本:V1.0.0 - * - * 修改者:唐有炜 时间:2014-11-05 16:29:42 - * 修改说明:修改说明 - * ======================================================================== -*/ -using System; -using System.Collections.Generic; -using System.Linq; -using NLite.Data; -using UCsoft.Entity; -using NLite.Reflection; -namespace UCsoft.Data -{ - public partial class DBContext:DbContext - { - #region 初始化上下文 - //连接字符串名称:基于Config文件中连接字符串的配置 - const string connectionStringName = "SqlServer"; - - //构造dbConfiguration 对象 - static DbConfiguration dbConfiguration; - - static DBContext() - { - dbConfiguration = DbConfiguration - .Configure(connectionStringName) - .SetSqlLogger(() =>SqlLog.Debug) - .AddFromAssemblyOf(t=>t.HasAttribute(false)) - ; - } - - public DBContext():base(dbConfiguration){} - #endregion - - #region 数据集关联 - public IDbSet TCusBases { get; private set; } - public IDbSet TCusCons { get; private set; } - public IDbSet TCusLogs { get; private set; } - public IDbSet TFunApps { get; private set; } - public IDbSet TFunAppCompanies { get; private set; } - public IDbSet TFunExpands { get; private set; } - public IDbSet TFunFilters { get; private set; } - public IDbSet TFunMyapps { get; private set; } - public IDbSet TFunMyappCompanies { get; private set; } - public IDbSet TFunOperatings { get; private set; } - public IDbSet TFunTags { get; private set; } - public IDbSet TSysCompanies { get; private set; } - public IDbSet TSysDepartments { get; private set; } - public IDbSet TSysLogs { get; private set; } - public IDbSet TSysPowers { get; private set; } - public IDbSet TSysRoles { get; private set; } - public IDbSet TSysUsers { get; private set; } - public IDbSet VAppCompanies { get; private set; } - public IDbSet VCompanyUsers { get; private set; } - public IDbSet VCustomerContacts { get; private set; } - public IDbSet VMyappCompanies { get; private set; } - public IDbSet VSysDepartments { get; private set; } - #endregion - } - } - \ No newline at end of file diff --git a/UCsoft.T4/Entity/Entity.cs b/UCsoft.T4/Entity/Entity.cs index 8fa3039..662e128 100644 --- a/UCsoft.T4/Entity/Entity.cs +++ b/UCsoft.T4/Entity/Entity.cs @@ -1,3 +1,64 @@  +using System; +using System.Collections.Generic; +using System.Linq; +using NLite.Data; +using UCsoft.Entity; +using NLite.Reflection; +namespace UCsoft.Data +{ + public partial class Entity:DbContext + { + #region 初始化上下文 + //连接字符串名称:基于Config文件中连接字符串的配置 + const string connectionStringName = "SqlServer"; + + //构造dbConfiguration 对象 + static DbConfiguration dbConfiguration; + + static Entity() + { + dbConfiguration = DbConfiguration + .Configure(connectionStringName) + .SetSqlLogger(() =>SqlLog.Debug) + .AddFromAssemblyOf(t=>t.HasAttribute(false)) + ; + } + + public Entity():base(dbConfiguration){} + #endregion + + #region 数据集关联 + public IDbSet TCusBases { get; private set; } + public IDbSet TCusCons { get; private set; } + public IDbSet TCusLogs { get; private set; } + public IDbSet TFunApps { get; private set; } + public IDbSet TFunAppCompanies { get; private set; } + public IDbSet TFunExpands { get; private set; } + public IDbSet TFunFilters { get; private set; } + public IDbSet TFunMyapps { get; private set; } + public IDbSet TFunMyappCompanies { get; private set; } + public IDbSet TFunOperatings { get; private set; } + public IDbSet TFunTags { get; private set; } + public IDbSet TSysCompanies { get; private set; } + public IDbSet TSysDepartments { get; private set; } + public IDbSet TSysLogs { get; private set; } + public IDbSet TSysPowers { get; private set; } + public IDbSet TSysRoles { get; private set; } + public IDbSet TSysUsers { get; private set; } + public IDbSet VAppCompanies { get; private set; } + public IDbSet VCompanyUsers { get; private set; } + public IDbSet VCustomerContacts { get; private set; } + public IDbSet VMyappCompanies { get; private set; } + public IDbSet VSysDepartments { get; private set; } + #endregion + } + + + } + + + + diff --git a/UCsoft.T4/Entity/Entity.tt b/UCsoft.T4/Entity/Entity.tt index ca8c448..819a5b8 100644 --- a/UCsoft.T4/Entity/Entity.tt +++ b/UCsoft.T4/Entity/Entity.tt @@ -47,14 +47,58 @@ #> <# - //开始Model====================================================================================== - foreach (var tb in databaseSchema.Tables){ +//开始DbContext====================================================================================== +#> +using System; +using System.Collections.Generic; +using System.Linq; +using NLite.Data; +using <#=@ModelNamespace#>; +using NLite.Reflection; +namespace <#= @contextNamespace #> +{ + public partial class <#= dbContextName #>:DbContext + { + #region 初始化上下文 + //连接字符串名称:基于Config文件中连接字符串的配置 + const string connectionStringName = "<#= connectionStringName #>"; + + //构造dbConfiguration 对象 + static DbConfiguration dbConfiguration; + + static <#= dbContextName #>() + { + dbConfiguration = DbConfiguration + .Configure(connectionStringName) + .SetSqlLogger(() =>SqlLog.Debug) + .AddFromAssemblyOf<<#= dbContextName #>>(t=>t.HasAttribute(false)) + ; + } + + public <#= dbContextName #>():base(dbConfiguration){} + #endregion + + #region 数据集关联 +<#foreach (var tb in databaseSchema.Tables.Union(databaseSchema.Views)){#> + public IDbSet<<#=NamingConversion.Default.ClassName(tb.TableName) #>> <#= NamingConversion.Default.QueryableName(tb.TableName) #> { get; private set; } +<#}#> + #endregion + } + <# +//结束DbContext====================================================================================== #> + + <# + //开始Model====================================================================================== + foreach (var tb in databaseSchema.Tables){ + #> + <# manager.StartNewFile(NamingConversion.Default.ClassName(tb.TableName)+ ".cs"); #> using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace <#= @ModelNamespace #> { @@ -78,14 +122,13 @@ namespace <#= @ModelNamespace #> public IList<<#= NamingConversion.Default.ClassName(fk.OtherTable.TableName) #>> <#= NamingConversion.Default.QueryableName(fk.OtherTable.TableName) #> { get;set; } <#}#> } -<# } - manager.EndBlock(); - foreach (var tb in databaseSchema.Views){ +<# } manager.EndBlock(); + foreach (var tb in databaseSchema.Views){ manager.StartNewFile(NamingConversion.Default.ClassName(tb.TableName) + ".cs"); //开始视图 #> -using System; + using System; using System.Collections.Generic; using System.Linq; using NLite.Data; @@ -102,6 +145,7 @@ namespace <#= @ModelNamespace #> <#}#> + } <# } @@ -109,7 +153,12 @@ namespace <#= @ModelNamespace #> manager.EndBlock(); manager.StartFooter(); #> + } + + + + <# //执行=================================================================================== manager.Process(true); diff --git a/UCsoft.T4/Entity/TCusBase.cs b/UCsoft.T4/Entity/TCusBase.cs index b19f2ce..e66809f 100644 --- a/UCsoft.T4/Entity/TCusBase.cs +++ b/UCsoft.T4/Entity/TCusBase.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -48,4 +49,9 @@ public partial class TCusBase } + } + + + + diff --git a/UCsoft.T4/Entity/TCusCon.cs b/UCsoft.T4/Entity/TCusCon.cs index b7863d6..0a12d6a 100644 --- a/UCsoft.T4/Entity/TCusCon.cs +++ b/UCsoft.T4/Entity/TCusCon.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -36,4 +37,9 @@ public partial class TCusCon } + } + + + + diff --git a/UCsoft.T4/Entity/TCusLog.cs b/UCsoft.T4/Entity/TCusLog.cs index f1d829c..45bc61e 100644 --- a/UCsoft.T4/Entity/TCusLog.cs +++ b/UCsoft.T4/Entity/TCusLog.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -24,4 +25,9 @@ public partial class TCusLog } + } + + + + diff --git a/UCsoft.T4/Entity/TFunApp.cs b/UCsoft.T4/Entity/TFunApp.cs index 7affba7..75d580f 100644 --- a/UCsoft.T4/Entity/TFunApp.cs +++ b/UCsoft.T4/Entity/TFunApp.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -50,4 +51,9 @@ public partial class TFunApp } + } + + + + diff --git a/UCsoft.T4/Entity/TFunAppCompany.cs b/UCsoft.T4/Entity/TFunAppCompany.cs index 1c4c17c..5f3f2ac 100644 --- a/UCsoft.T4/Entity/TFunAppCompany.cs +++ b/UCsoft.T4/Entity/TFunAppCompany.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -22,4 +23,9 @@ public partial class TFunAppCompany } + } + + + + diff --git a/UCsoft.T4/Entity/TFunExpand.cs b/UCsoft.T4/Entity/TFunExpand.cs index 9456867..1eee0e9 100644 --- a/UCsoft.T4/Entity/TFunExpand.cs +++ b/UCsoft.T4/Entity/TFunExpand.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -60,4 +61,9 @@ public partial class TFunExpand } + } + + + + diff --git a/UCsoft.T4/Entity/TFunFilter.cs b/UCsoft.T4/Entity/TFunFilter.cs index bb1b9ad..9bf36e5 100644 --- a/UCsoft.T4/Entity/TFunFilter.cs +++ b/UCsoft.T4/Entity/TFunFilter.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -32,4 +33,9 @@ public partial class TFunFilter } + } + + + + diff --git a/UCsoft.T4/Entity/TFunMyapp.cs b/UCsoft.T4/Entity/TFunMyapp.cs index a6becf7..8f528d2 100644 --- a/UCsoft.T4/Entity/TFunMyapp.cs +++ b/UCsoft.T4/Entity/TFunMyapp.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -42,4 +43,9 @@ public partial class TFunMyapp public IList TFunExpands { get;set; } } + } + + + + diff --git a/UCsoft.T4/Entity/TFunMyappCompany.cs b/UCsoft.T4/Entity/TFunMyappCompany.cs index 0910465..accdfa6 100644 --- a/UCsoft.T4/Entity/TFunMyappCompany.cs +++ b/UCsoft.T4/Entity/TFunMyappCompany.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -18,4 +19,9 @@ public partial class TFunMyappCompany } + } + + + + diff --git a/UCsoft.T4/Entity/TFunOperating.cs b/UCsoft.T4/Entity/TFunOperating.cs index 60ec091..f32de65 100644 --- a/UCsoft.T4/Entity/TFunOperating.cs +++ b/UCsoft.T4/Entity/TFunOperating.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -36,4 +37,9 @@ public partial class TFunOperating } + } + + + + diff --git a/UCsoft.T4/Entity/TFunTag.cs b/UCsoft.T4/Entity/TFunTag.cs index 2c09173..220869c 100644 --- a/UCsoft.T4/Entity/TFunTag.cs +++ b/UCsoft.T4/Entity/TFunTag.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -24,4 +25,9 @@ public partial class TFunTag } + } + + + + diff --git a/UCsoft.T4/Entity/TSysCompany.cs b/UCsoft.T4/Entity/TSysCompany.cs index ed9b7be..99968f7 100644 --- a/UCsoft.T4/Entity/TSysCompany.cs +++ b/UCsoft.T4/Entity/TSysCompany.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -19,4 +20,9 @@ public partial class TSysCompany } + } + + + + diff --git a/UCsoft.T4/Entity/TSysDepartment.cs b/UCsoft.T4/Entity/TSysDepartment.cs index bd4b577..32f65de 100644 --- a/UCsoft.T4/Entity/TSysDepartment.cs +++ b/UCsoft.T4/Entity/TSysDepartment.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -38,4 +39,9 @@ public partial class TSysDepartment public IList TSysUsers { get;set; } } + } + + + + diff --git a/UCsoft.T4/Entity/TSysLog.cs b/UCsoft.T4/Entity/TSysLog.cs index dae70f8..4061f62 100644 --- a/UCsoft.T4/Entity/TSysLog.cs +++ b/UCsoft.T4/Entity/TSysLog.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -28,4 +29,9 @@ public partial class TSysLog } + } + + + + diff --git a/UCsoft.T4/Entity/TSysPower.cs b/UCsoft.T4/Entity/TSysPower.cs index aa3012e..e2fbfab 100644 --- a/UCsoft.T4/Entity/TSysPower.cs +++ b/UCsoft.T4/Entity/TSysPower.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -22,4 +23,9 @@ public partial class TSysPower } + } + + + + diff --git a/UCsoft.T4/Entity/TSysRole.cs b/UCsoft.T4/Entity/TSysRole.cs index da6fa69..fa3759c 100644 --- a/UCsoft.T4/Entity/TSysRole.cs +++ b/UCsoft.T4/Entity/TSysRole.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -26,4 +27,9 @@ public partial class TSysRole } + } + + + + diff --git a/UCsoft.T4/Entity/TSysUser.cs b/UCsoft.T4/Entity/TSysUser.cs index 4f76603..a2da2e4 100644 --- a/UCsoft.T4/Entity/TSysUser.cs +++ b/UCsoft.T4/Entity/TSysUser.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using NLite.Data; namespace UCsoft.Entity { @@ -50,4 +51,9 @@ public partial class TSysUser } + } + + + + diff --git a/UCsoft.T4/Entity/VAppCompany.cs b/UCsoft.T4/Entity/VAppCompany.cs index 8428ee4..25e7a1b 100644 --- a/UCsoft.T4/Entity/VAppCompany.cs +++ b/UCsoft.T4/Entity/VAppCompany.cs @@ -1,5 +1,5 @@  -using System; + using System; using System.Collections.Generic; using System.Linq; using NLite.Data; @@ -103,5 +103,11 @@ public partial class VAppCompany + } + } + + + + diff --git a/UCsoft.T4/Entity/VCompanyUser.cs b/UCsoft.T4/Entity/VCompanyUser.cs index 4c0be15..2f21746 100644 --- a/UCsoft.T4/Entity/VCompanyUser.cs +++ b/UCsoft.T4/Entity/VCompanyUser.cs @@ -1,5 +1,5 @@  -using System; + using System; using System.Collections.Generic; using System.Linq; using NLite.Data; @@ -79,5 +79,11 @@ public partial class VCompanyUser + } + } + + + + diff --git a/UCsoft.T4/Entity/VCustomerContact.cs b/UCsoft.T4/Entity/VCustomerContact.cs index 2cd460a..3230e1f 100644 --- a/UCsoft.T4/Entity/VCustomerContact.cs +++ b/UCsoft.T4/Entity/VCustomerContact.cs @@ -1,5 +1,5 @@  -using System; + using System; using System.Collections.Generic; using System.Linq; using NLite.Data; @@ -119,5 +119,11 @@ public partial class VCustomerContact + } + } + + + + diff --git a/UCsoft.T4/Entity/VMyappCompany.cs b/UCsoft.T4/Entity/VMyappCompany.cs index 995a560..9a72722 100644 --- a/UCsoft.T4/Entity/VMyappCompany.cs +++ b/UCsoft.T4/Entity/VMyappCompany.cs @@ -1,5 +1,5 @@  -using System; + using System; using System.Collections.Generic; using System.Linq; using NLite.Data; @@ -59,5 +59,11 @@ public partial class VMyappCompany + } + } + + + + diff --git a/UCsoft.T4/Entity/VSysDepartment.cs b/UCsoft.T4/Entity/VSysDepartment.cs index 19cd290..8b0f8ce 100644 --- a/UCsoft.T4/Entity/VSysDepartment.cs +++ b/UCsoft.T4/Entity/VSysDepartment.cs @@ -1,5 +1,5 @@  -using System; + using System; using System.Collections.Generic; using System.Linq; using NLite.Data; @@ -63,5 +63,11 @@ public partial class VSysDepartment + } + } + + + + diff --git a/UCsoft.T4/UCsoft.T4.csproj b/UCsoft.T4/UCsoft.T4.csproj index ec5101e..5fbc694 100644 --- a/UCsoft.T4/UCsoft.T4.csproj +++ b/UCsoft.T4/UCsoft.T4.csproj @@ -52,11 +52,6 @@ - - True - True - DBContext.tt - True True @@ -153,6 +148,12 @@ + + + {45e160a7-334b-4473-ad23-4753a456b6e8} + UCsoft.Entity + +