Browse Source

上传文件至 'EMIS.Entities.Log'

EMIS.Entities.Log
lxl 2 years ago
parent
commit
37d43312f8

+ 20 - 0
EMIS.Entities.Log/App.config

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <configSections>
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+  </configSections>
+  <entityFramework>
+    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
+      <parameters>
+        <parameter value="v11.0" />
+      </parameters>
+    </defaultConnectionFactory>
+    <providers>
+      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+    </providers>
+  </entityFramework>
+  <connectionStrings>
+    <add name="EMISNewLogContext" connectionString="metadata=res://*/EMISLogContext.csdl|res://*/EMISLogContext.ssdl|res://*/EMISLogContext.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.0.29\sql2008;initial catalog=EMISNewLog;persist security info=True;user id=sa;password=1;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
+  </connectionStrings>
+</configuration>

+ 55 - 0
EMIS.Entities.Log/EMIS.Entities.Log.Context.cs

@@ -0,0 +1,55 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//    This code was generated from a template.
+//
+//    Manual changes to this file may cause unexpected behavior in your application.
+//    Manual changes to this file will be overwritten if the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+#pragma warning disable 1573
+namespace EMIS.Entities.Log
+{
+    using System;
+    using System.Data.Common;
+    using System.Data.Entity;
+    using System.Data.Entity.Infrastructure;
+    using EntityFramework.Extensions;
+    using System.Linq.Expressions;
+    using System.Data.Entity.Core.Objects;
+    
+    public partial class EMISNewLogContext : DbContext
+    {
+        static EMISNewLogContext()
+    	{ 
+    		Database.SetInitializer<EMISNewLogContext>(null);
+    	}
+    	
+    	public EMISNewLogContext() : base("name=EMISNewLogContext") {
+            var objectContext = (this as IObjectContextAdapter).ObjectContext;
+    
+            objectContext.CommandTimeout = 12000;
+            base.Configuration.ProxyCreationEnabled = false;
+        }
+        public EMISNewLogContext(string nameOrConnectionString) : base(nameOrConnectionString) {
+            var objectContext = (this as IObjectContextAdapter).ObjectContext;
+    
+            objectContext.CommandTimeout = 12000;
+            base.Configuration.ProxyCreationEnabled = false;
+        }
+        protected void Delete<TEntity>(Expression<Func<TEntity, bool>> whereExpression) where TEntity : class
+        {
+            var context = ((IObjectContextAdapter)this).ObjectContext;
+            IObjectSet<TEntity> source = context.CreateObjectSet<TEntity>();
+            source.Delete(whereExpression);
+        }
+        protected override void OnModelCreating(DbModelBuilder modelBuilder)
+        {
+    		modelBuilder.Conventions.Remove<IncludeMetadataConvention>();
+    		modelBuilder.Configurations.Add(new Log_Operate_Mapping());
+    		modelBuilder.Configurations.Add(new VW_Sys_User_Mapping());
+        }
+    	
+        public DbSet<Log_Operate> Log_Operate { get; set; }
+        public DbSet<VW_Sys_User> VW_Sys_User { get; set; }
+    }
+}

+ 210 - 0
EMIS.Entities.Log/EMIS.Entities.Log.Context.tt

@@ -0,0 +1,210 @@
+<#@ template language="C#" debug="false" hostspecific="true"#>
+<#@ include file="EF.Utility.CS.ttinclude"#><#@
+ output extension=".cs"#><#
+
+var loader = new MetadataLoader(this);
+var region = new CodeRegion(this);
+var inputFile = @"EMISLogContext.edmx";
+var ItemCollection = loader.CreateEdmItemCollection(inputFile);
+
+Code = new CodeGenerationTools(this);
+EFTools = new MetadataTools(this);
+ObjectNamespace = Code.VsNamespaceSuggestion();
+ModelNamespace = loader.GetModelNamespace(inputFile);
+
+EntityContainer container = ItemCollection.GetItems<EntityContainer>().FirstOrDefault();
+if (container == null)
+{
+    return string.Empty;
+}
+#>
+//------------------------------------------------------------------------------
+// <auto-generated>
+//    This code was generated from a template.
+//
+//    Manual changes to this file may cause unexpected behavior in your application.
+//    Manual changes to this file will be overwritten if the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+#pragma warning disable 1573
+<#
+
+if (!String.IsNullOrEmpty(ObjectNamespace))
+{
+#>
+namespace <#=Code.EscapeNamespace(ObjectNamespace)#>
+{
+<#
+    PushIndent(CodeRegion.GetIndent(1));
+}
+
+#>
+using System;
+using System.Data.Common;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+using EntityFramework.Extensions;
+using System.Linq.Expressions;
+using System.Data.Entity.Core.Objects;
+<#
+if (container.FunctionImports.Any())
+{
+#>
+using System.Data.Objects;
+<#
+}
+#>
+
+<#=Accessibility.ForType(container)#> partial class <#=Code.Escape(container)#> : DbContext
+{
+    static <#=Code.Escape(container)#>()
+	{ 
+		Database.SetInitializer<<#=Code.Escape(container)#>>(null);
+	}
+	
+	public <#=Code.Escape(container)#>() : base("name=<#=container.Name#>") {
+        var objectContext = (this as IObjectContextAdapter).ObjectContext;
+
+        objectContext.CommandTimeout = 12000;
+        base.Configuration.ProxyCreationEnabled = false;
+    }
+    public <#=Code.Escape(container)#>(string nameOrConnectionString) : base(nameOrConnectionString) {
+        var objectContext = (this as IObjectContextAdapter).ObjectContext;
+
+        objectContext.CommandTimeout = 12000;
+        base.Configuration.ProxyCreationEnabled = false;
+    }
+    protected void Delete<TEntity>(Expression<Func<TEntity, bool>> whereExpression) where TEntity : class
+    {
+        var context = ((IObjectContextAdapter)this).ObjectContext;
+        IObjectSet<TEntity> source = context.CreateObjectSet<TEntity>();
+        source.Delete(whereExpression);
+    }
+    protected override void OnModelCreating(DbModelBuilder modelBuilder)
+    {
+		modelBuilder.Conventions.Remove<IncludeMetadataConvention>();
+<# 
+    foreach (EntityType entitySet in ItemCollection.GetItems<EntityType>().OrderBy(e => e.Name))
+    {
+#>
+		modelBuilder.Configurations.Add(new <#=Code.Escape(entitySet.Name)#>_Mapping());
+<#
+    }
+#>
+    }
+	
+<#
+    foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
+    {
+#>
+    <#=Accessibility.ForReadOnlyProperty(entitySet)#> DbSet<<#=Code.Escape(entitySet.ElementType)#>> <#=Code.Escape(entitySet)#> { get; set; }
+<#
+    }
+
+    foreach (var edmFunction in container.FunctionImports)
+    {
+        WriteFunctionImport(edmFunction, false);
+    }
+#>
+}
+<#
+
+if (!String.IsNullOrEmpty(ObjectNamespace))
+{
+    PopIndent();
+#>
+}
+<#
+}
+#>
+<#+
+string ModelNamespace { get; set; }
+string ObjectNamespace { get; set; }
+CodeGenerationTools Code { get; set; }
+MetadataTools EFTools { get; set; }
+
+void WriteLazyLoadingEnabled(EntityContainer container)
+{
+   string lazyLoadingAttributeValue = null;
+   var lazyLoadingAttributeName = MetadataConstants.EDM_ANNOTATION_09_02 + ":LazyLoadingEnabled";
+   if(MetadataTools.TryGetStringMetadataPropertySetting(container, lazyLoadingAttributeName, out lazyLoadingAttributeValue))
+   {
+       bool isLazyLoading;
+       if(bool.TryParse(lazyLoadingAttributeValue, out isLazyLoading) && !isLazyLoading)
+       {
+#>
+        this.Configuration.LazyLoadingEnabled = false;
+<#+
+       }
+   }
+}
+
+void WriteFunctionImport(EdmFunction edmFunction, bool includeMergeOption)
+{
+    var parameters = FunctionImportParameter.Create(edmFunction.Parameters, Code, EFTools);
+    var paramList = String.Join(", ", parameters.Select(p => p.FunctionParameterType + " " + p.FunctionParameterName).ToArray());
+    var returnType = edmFunction.ReturnParameter == null ? null : EFTools.GetElementType(edmFunction.ReturnParameter.TypeUsage);
+    var processedReturn = returnType == null ? "int" : "ObjectResult<" + MultiSchemaEscape(returnType) + ">";
+
+    if (includeMergeOption)
+    {
+        paramList = Code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
+    }
+#>
+
+    <#=AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction))#> <#=processedReturn#> <#=Code.Escape(edmFunction)#>(<#=paramList#>)
+    {
+<#+
+        if(returnType != null && (returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType ||
+                                  returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.ComplexType))
+        {
+#>
+        ((IObjectContextAdapter)this).ObjectContext.MetadataWorkspace.LoadFromAssembly(typeof(<#=MultiSchemaEscape(returnType)#>).Assembly);
+
+<#+
+        }
+
+        foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
+        {
+            var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
+            var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
+            var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + parameter.RawClrTypeName + "))";
+#>
+        var <#=parameter.LocalVariableName#> = <#=isNotNull#> ?
+            <#=notNullInit#> :
+            <#=nullInit#>;
+
+<#+
+        }
+
+        var genericArg = returnType == null ? "" : "<" + MultiSchemaEscape(returnType) + ">";
+        var callParams = Code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
+
+        if (includeMergeOption)
+        {
+            callParams = ", mergeOption" + callParams;
+        }
+#>
+        return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<#=genericArg#>("<#=edmFunction.Name#>"<#=callParams#>);
+    }
+<#+
+    if(!includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType)
+    {
+        WriteFunctionImport(edmFunction, true);
+    }
+}
+
+string AccessibilityAndVirtual(string accessibility)
+{
+    return accessibility + (accessibility != "private" ? " virtual" : "");
+}
+
+string MultiSchemaEscape(TypeUsage usage)
+{
+    var type = usage.EdmType as StructuralType;
+    return type != null && type.NamespaceName != ModelNamespace ?
+        Code.CreateFullName(Code.EscapeNamespace(type.NamespaceName), Code.Escape(type)) :
+        Code.Escape(usage);
+}
+
+#>

+ 9 - 0
EMIS.Entities.Log/EMIS.Entities.Log.cs

@@ -0,0 +1,9 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//    This code was generated from a template.
+//
+//    Manual changes to this file may cause unexpected behavior in your application.
+//    Manual changes to this file will be overwritten if the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+

+ 143 - 0
EMIS.Entities.Log/EMIS.Entities.Log.csproj

@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{DB95178F-587B-4F96-88DA-D4FD8EF75BFF}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>EMIS.Entities.Log</RootNamespace>
+    <AssemblyName>EMIS.Entities.Log</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <SccProjectName>
+    </SccProjectName>
+    <SccLocalPath>
+    </SccLocalPath>
+    <SccAuxPath>
+    </SccAuxPath>
+    <SccProvider>
+    </SccProvider>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.1.3\lib\net40\EntityFramework.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="EntityFramework.Extended, Version=6.0.0.0, Culture=neutral, PublicKeyToken=05b7e29bdd433584, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.Extended.6.1.0.168\lib\net40\EntityFramework.Extended.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.1.3\lib\net40\EntityFramework.SqlServer.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Data.Entity" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.Security" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="EMIS.Entities.Log.Context.cs">
+      <DependentUpon>EMIS.Entities.Log.Context.tt</DependentUpon>
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+    </Compile>
+    <Compile Include="EMIS.Entities.Log.cs">
+      <DependentUpon>EMIS.Entities.Log.tt</DependentUpon>
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+    </Compile>
+    <Compile Include="EMIS.Entities.Log.Mapping.cs">
+      <DependentUpon>EMIS.Entities.Log.Mapping.tt</DependentUpon>
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+    </Compile>
+    <Compile Include="EMISLogContext.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>EMISLogContext.edmx</DependentUpon>
+    </Compile>
+    <Compile Include="Log_Operate.cs">
+      <DependentUpon>EMIS.Entities.Log.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Log_Operate_Mapping.cs">
+      <DependentUpon>EMIS.Entities.Log.Mapping.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="TableKey.cs">
+      <DependentUpon>TableKey.tt</DependentUpon>
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+    </Compile>
+    <Compile Include="VW_Sys_User.cs">
+      <DependentUpon>EMIS.Entities.Log.tt</DependentUpon>
+    </Compile>
+    <Compile Include="VW_Sys_User_Mapping.cs">
+      <DependentUpon>EMIS.Entities.Log.Mapping.tt</DependentUpon>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+    <None Include="EMISLogContext.edmx">
+      <Generator>EntityModelCodeGenerator</Generator>
+      <LastGenOutput>EMISLogContext.Designer.cs</LastGenOutput>
+    </None>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="EMIS.Entities.Log.Context.tt">
+      <Generator>TextTemplatingFileGenerator</Generator>
+      <LastGenOutput>EMIS.Entities.Log.Context.cs</LastGenOutput>
+    </Content>
+    <Content Include="EMIS.Entities.Log.tt">
+      <Generator>TextTemplatingFileGenerator</Generator>
+      <LastGenOutput>EMIS.Entities.Log.cs</LastGenOutput>
+    </Content>
+    <Content Include="EMIS.Entities.Log.Mapping.tt">
+      <Generator>TextTemplatingFileGenerator</Generator>
+      <LastGenOutput>EMIS.Entities.Log.Mapping.cs</LastGenOutput>
+    </Content>
+    <Content Include="TableKey.tt">
+      <Generator>TextTemplatingFileGenerator</Generator>
+      <LastGenOutput>TableKey.cs</LastGenOutput>
+    </Content>
+  </ItemGroup>
+  <ItemGroup>
+    <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>