적정인원보고서 완료

This commit is contained in:
chi
2020-11-09 08:20:03 +09:00
parent ed3517eb79
commit ce56a715f0
56 changed files with 5371 additions and 1760 deletions

View File

@@ -0,0 +1,33 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 템플릿에서 생성되었습니다.
//
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Project
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class EEEntitiesMain : DbContext
{
public EEEntitiesMain()
: base("name=EEEntitiesMain")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<EETGW_GroupUser> EETGW_GroupUser { get; set; }
public virtual DbSet<UserGroup> UserGroup { get; set; }
public virtual DbSet<Users> Users { get; set; }
public virtual DbSet<vGroupUser> vGroupUser { get; set; }
}
}

View File

@@ -0,0 +1,636 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"AdoNetEFMain.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
var itemCollection = loader.CreateEdmItemCollection(inputFile);
var modelNamespace = loader.GetModelNamespace(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
if (container == null)
{
return string.Empty;
}
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#
PushIndent(" ");
}
#>
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
<#
if (container.FunctionImports.Any())
{
#>
using System.Data.Entity.Core.Objects;
using System.Linq;
<#
}
#>
<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
{
public <#=code.Escape(container)#>()
: base("name=<#=container.Name#>")
{
<#
if (!loader.IsLazyLoadingEnabled(container))
{
#>
this.Configuration.LazyLoadingEnabled = false;
<#
}
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
// Note: the DbSet members are defined below such that the getter and
// setter always have the same accessibility as the DbSet definition
if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
{
#>
<#=codeStringGenerator.DbSetInitializer(entitySet)#>
<#
}
}
#>
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
<#
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
#>
<#=codeStringGenerator.DbSet(entitySet)#>
<#
}
foreach (var edmFunction in container.FunctionImports)
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
}
#>
}
<#
if (!String.IsNullOrEmpty(codeNamespace))
{
PopIndent();
#>
}
<#
}
#>
<#+
private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
if (typeMapper.IsComposable(edmFunction))
{
#>
[DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
<#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
}
<#+
}
else
{
#>
<#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
{
<#+
codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
#>
<#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
}
<#+
if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
{
WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
}
}
}
public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
{
#>
var <#=name#> = <#=isNotNull#> ?
<#=notNullInit#> :
<#=nullInit#>;
<#+
}
public const string TemplateId = "CSharp_DbContext_Context_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
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(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string DbSetInitializer(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} = Set<{1}>();",
_code.Escape(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

10
Project/AdoNetEFMain.Designer.cs generated Normal file
View File

@@ -0,0 +1,10 @@
// 모델 'D:\Source\##### 완료아이템\(014) GroupWare\Source\Project\AdoNetEFMain.edmx'에 대해 T4 코드 생성이 사용됩니다.
// 레거시 코드 생성을 사용하려면 '코드 생성 전략' 디자이너 속성의 값을
// 'Legacy ObjectContext'로 변경하십시오. 이 속성은 모델이 디자이너에서 열릴 때
// 속성 창에서 사용할 수 있습니다.
// 컨텍스트 및 엔터티 클래스가 생성되지 않은 경우 빈 모델을 만들었기 때문일 수도 있지만
// 사용할 Entity Framework 버전을 선택하지 않았기 때문일 수도 있습니다. 모델에 맞는 컨텍스트 클래스 및
// 엔터티 클래스를 생성하려면 디자이너에서 모델을 열고 디자이너 화면에서 마우스 오른쪽 단추를 클릭한
// 다음 '데이터베이스에서 모델 업데이트...', '모델에서 데이터베이스 생성...' 또는 '코드 생성 항목 추가...'를
// 선택하십시오.

9
Project/AdoNetEFMain.cs Normal file
View File

@@ -0,0 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 템플릿에서 생성되었습니다.
//
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
// </auto-generated>
//------------------------------------------------------------------------------

294
Project/AdoNetEFMain.edmx Normal file
View File

@@ -0,0 +1,294 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="EEModelMain.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2008" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<EntityType Name="EETGW_GroupUser">
<Key>
<PropertyRef Name="idx" />
</Key>
<Property Name="idx" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="gcode" Type="varchar" MaxLength="10" Nullable="false" />
<Property Name="uid" Type="varchar" MaxLength="20" Nullable="false" />
<Property Name="level" Type="smallint" />
<Property Name="Process" Type="varchar" MaxLength="50" />
<Property Name="wuid" Type="varchar" MaxLength="20" Nullable="false" />
<Property Name="wdate" Type="smalldatetime" Nullable="false" />
</EntityType>
<EntityType Name="UserGroup">
<Key>
<PropertyRef Name="dept" />
</Key>
<Property Name="dept" Type="varchar" MaxLength="100" Nullable="false" />
<Property Name="gcode" Type="varchar" MaxLength="10" />
<Property Name="path_kj" Type="nvarchar" MaxLength="100" />
<Property Name="advpurchase" Type="bit" />
<Property Name="permission" Type="int" />
</EntityType>
<EntityType Name="Users">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="varchar" MaxLength="20" Nullable="false" />
<Property Name="gcode" Type="varchar" MaxLength="10" />
<Property Name="password" Type="varchar" MaxLength="50" />
<Property Name="nameE" Type="nvarchar" MaxLength="100" />
<Property Name="name" Type="nvarchar" MaxLength="100" />
<Property Name="dept" Type="varchar" MaxLength="100" />
<Property Name="grade" Type="varchar" MaxLength="10" />
<Property Name="email" Type="varchar" MaxLength="100" />
<Property Name="level" Type="smallint" />
<Property Name="indate" Type="varchar" MaxLength="20" />
<Property Name="outdate" Type="varchar" MaxLength="20" />
<Property Name="tel" Type="varchar" MaxLength="20" />
<Property Name="hp" Type="varchar" MaxLength="20" />
<Property Name="place" Type="varchar" MaxLength="100" />
<Property Name="ads_employNo" Type="varchar" MaxLength="50" />
<Property Name="ads_title" Type="nvarchar" MaxLength="100" />
<Property Name="ads_created" Type="varchar" MaxLength="50" />
<Property Name="memo" Type="nvarchar" MaxLength="255" />
<Property Name="wuid" Type="varchar" MaxLength="20" Nullable="false" />
<Property Name="wdate" Type="smalldatetime" Nullable="false" />
<Property Name="processs" Type="nvarchar" MaxLength="100" />
</EntityType>
<!--생성 중 오류 발생:
경고 6002: 테이블/뷰 'EE.dbo.vGroupUser'에 기본 키가 정의되지 않았습니다. 키가 유추되었고 읽기 전용 테이블/뷰로 정의되었습니다.-->
<EntityType Name="vGroupUser">
<Key>
<PropertyRef Name="gcode" />
</Key>
<Property Name="gcode" Type="varchar" MaxLength="10" Nullable="false" />
<Property Name="dept" Type="varchar" MaxLength="100" />
<Property Name="level" Type="smallint" />
<Property Name="name" Type="nvarchar" MaxLength="100" />
<Property Name="nameE" Type="nvarchar" MaxLength="100" />
<Property Name="grade" Type="varchar" MaxLength="10" />
<Property Name="email" Type="varchar" MaxLength="100" />
<Property Name="tel" Type="varchar" MaxLength="20" />
<Property Name="indate" Type="varchar" MaxLength="20" />
<Property Name="outdate" Type="varchar" MaxLength="20" />
<Property Name="hp" Type="varchar" MaxLength="20" />
<Property Name="place" Type="varchar" MaxLength="100" />
<Property Name="ads_employNo" Type="varchar" MaxLength="50" />
<Property Name="ads_title" Type="nvarchar" MaxLength="100" />
<Property Name="ads_created" Type="varchar" MaxLength="50" />
<Property Name="memo" Type="nvarchar" MaxLength="255" />
<Property Name="processs" Type="varchar" MaxLength="50" />
<Property Name="id" Type="varchar" MaxLength="20" />
</EntityType>
<EntityContainer Name="EEModelMainStoreContainer">
<EntitySet Name="EETGW_GroupUser" EntityType="Self.EETGW_GroupUser" Schema="dbo" store:Type="Tables" />
<EntitySet Name="UserGroup" EntityType="Self.UserGroup" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Users" EntityType="Self.Users" Schema="dbo" store:Type="Tables" />
<EntitySet Name="vGroupUser" EntityType="Self.vGroupUser" store:Type="Views" store:Schema="dbo">
<DefiningQuery>SELECT
[vGroupUser].[gcode] AS [gcode],
[vGroupUser].[dept] AS [dept],
[vGroupUser].[level] AS [level],
[vGroupUser].[name] AS [name],
[vGroupUser].[nameE] AS [nameE],
[vGroupUser].[grade] AS [grade],
[vGroupUser].[email] AS [email],
[vGroupUser].[tel] AS [tel],
[vGroupUser].[indate] AS [indate],
[vGroupUser].[outdate] AS [outdate],
[vGroupUser].[hp] AS [hp],
[vGroupUser].[place] AS [place],
[vGroupUser].[ads_employNo] AS [ads_employNo],
[vGroupUser].[ads_title] AS [ads_title],
[vGroupUser].[ads_created] AS [ads_created],
[vGroupUser].[memo] AS [memo],
[vGroupUser].[processs] AS [processs],
[vGroupUser].[id] AS [id]
FROM [dbo].[vGroupUser] AS [vGroupUser]</DefiningQuery>
</EntitySet>
</EntityContainer>
</Schema>
</edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="EEModelMain" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityType Name="EETGW_GroupUser">
<Key>
<PropertyRef Name="idx" />
</Key>
<Property Name="idx" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="gcode" Type="String" MaxLength="10" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="uid" Type="String" MaxLength="20" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="level" Type="Int16" />
<Property Name="Process" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="wuid" Type="String" MaxLength="20" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="wdate" Type="DateTime" Nullable="false" Precision="0" />
</EntityType>
<EntityType Name="UserGroup">
<Key>
<PropertyRef Name="dept" />
</Key>
<Property Name="dept" Type="String" MaxLength="100" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="gcode" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="path_kj" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
<Property Name="advpurchase" Type="Boolean" />
<Property Name="permission" Type="Int32" />
</EntityType>
<EntityType Name="Users">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="id" Type="String" MaxLength="20" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="gcode" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="password" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="nameE" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
<Property Name="name" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
<Property Name="dept" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
<Property Name="grade" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="email" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
<Property Name="level" Type="Int16" />
<Property Name="indate" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
<Property Name="outdate" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
<Property Name="tel" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
<Property Name="hp" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
<Property Name="place" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
<Property Name="ads_employNo" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="ads_title" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
<Property Name="ads_created" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="memo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
<Property Name="wuid" Type="String" MaxLength="20" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="wdate" Type="DateTime" Nullable="false" Precision="0" />
<Property Name="processs" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
</EntityType>
<EntityType Name="vGroupUser">
<Key>
<PropertyRef Name="gcode" />
</Key>
<Property Name="gcode" Type="String" MaxLength="10" FixedLength="false" Unicode="false" Nullable="false" />
<Property Name="dept" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
<Property Name="level" Type="Int16" />
<Property Name="name" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
<Property Name="nameE" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
<Property Name="grade" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="email" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
<Property Name="tel" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
<Property Name="indate" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
<Property Name="outdate" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
<Property Name="hp" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
<Property Name="place" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
<Property Name="ads_employNo" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="ads_title" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
<Property Name="ads_created" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="memo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
<Property Name="processs" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="id" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
</EntityType>
<EntityContainer Name="EEEntitiesMain" annotation:LazyLoadingEnabled="true">
<EntitySet Name="EETGW_GroupUser" EntityType="Self.EETGW_GroupUser" />
<EntitySet Name="UserGroup" EntityType="Self.UserGroup" />
<EntitySet Name="Users" EntityType="Self.Users" />
<EntitySet Name="vGroupUser" EntityType="Self.vGroupUser" />
</EntityContainer>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
<EntityContainerMapping StorageEntityContainer="EEModelMainStoreContainer" CdmEntityContainer="EEEntitiesMain">
<EntitySetMapping Name="EETGW_GroupUser">
<EntityTypeMapping TypeName="EEModelMain.EETGW_GroupUser">
<MappingFragment StoreEntitySet="EETGW_GroupUser">
<ScalarProperty Name="idx" ColumnName="idx" />
<ScalarProperty Name="gcode" ColumnName="gcode" />
<ScalarProperty Name="uid" ColumnName="uid" />
<ScalarProperty Name="level" ColumnName="level" />
<ScalarProperty Name="Process" ColumnName="Process" />
<ScalarProperty Name="wuid" ColumnName="wuid" />
<ScalarProperty Name="wdate" ColumnName="wdate" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="UserGroup">
<EntityTypeMapping TypeName="EEModelMain.UserGroup">
<MappingFragment StoreEntitySet="UserGroup">
<ScalarProperty Name="dept" ColumnName="dept" />
<ScalarProperty Name="gcode" ColumnName="gcode" />
<ScalarProperty Name="path_kj" ColumnName="path_kj" />
<ScalarProperty Name="advpurchase" ColumnName="advpurchase" />
<ScalarProperty Name="permission" ColumnName="permission" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Users">
<EntityTypeMapping TypeName="EEModelMain.Users">
<MappingFragment StoreEntitySet="Users">
<ScalarProperty Name="id" ColumnName="id" />
<ScalarProperty Name="gcode" ColumnName="gcode" />
<ScalarProperty Name="password" ColumnName="password" />
<ScalarProperty Name="nameE" ColumnName="nameE" />
<ScalarProperty Name="name" ColumnName="name" />
<ScalarProperty Name="dept" ColumnName="dept" />
<ScalarProperty Name="grade" ColumnName="grade" />
<ScalarProperty Name="email" ColumnName="email" />
<ScalarProperty Name="level" ColumnName="level" />
<ScalarProperty Name="indate" ColumnName="indate" />
<ScalarProperty Name="outdate" ColumnName="outdate" />
<ScalarProperty Name="tel" ColumnName="tel" />
<ScalarProperty Name="hp" ColumnName="hp" />
<ScalarProperty Name="place" ColumnName="place" />
<ScalarProperty Name="ads_employNo" ColumnName="ads_employNo" />
<ScalarProperty Name="ads_title" ColumnName="ads_title" />
<ScalarProperty Name="ads_created" ColumnName="ads_created" />
<ScalarProperty Name="memo" ColumnName="memo" />
<ScalarProperty Name="wuid" ColumnName="wuid" />
<ScalarProperty Name="wdate" ColumnName="wdate" />
<ScalarProperty Name="processs" ColumnName="processs" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="vGroupUser">
<EntityTypeMapping TypeName="EEModelMain.vGroupUser">
<MappingFragment StoreEntitySet="vGroupUser">
<ScalarProperty Name="gcode" ColumnName="gcode" />
<ScalarProperty Name="dept" ColumnName="dept" />
<ScalarProperty Name="level" ColumnName="level" />
<ScalarProperty Name="name" ColumnName="name" />
<ScalarProperty Name="nameE" ColumnName="nameE" />
<ScalarProperty Name="grade" ColumnName="grade" />
<ScalarProperty Name="email" ColumnName="email" />
<ScalarProperty Name="tel" ColumnName="tel" />
<ScalarProperty Name="indate" ColumnName="indate" />
<ScalarProperty Name="outdate" ColumnName="outdate" />
<ScalarProperty Name="hp" ColumnName="hp" />
<ScalarProperty Name="place" ColumnName="place" />
<ScalarProperty Name="ads_employNo" ColumnName="ads_employNo" />
<ScalarProperty Name="ads_title" ColumnName="ads_title" />
<ScalarProperty Name="ads_created" ColumnName="ads_created" />
<ScalarProperty Name="memo" ColumnName="memo" />
<ScalarProperty Name="processs" ColumnName="processs" />
<ScalarProperty Name="id" ColumnName="id" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</Connection>
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="false" />
<DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
<DesignerProperty Name="UseLegacyProvider" Value="false" />
<DesignerProperty Name="CodeGenerationStrategy" Value="없음" />
</DesignerInfoPropertySet>
</Options>
<!-- Diagram content (shape and connector positions) -->
<Diagrams></Diagrams>
</Designer>
</edmx:Edmx>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="1357493607fd4a93b6b3d9fc19689b4f" Name="Diagram1">
<EntityTypeShape EntityType="EEModelMain.EETGW_GroupUser" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
<EntityTypeShape EntityType="EEModelMain.UserGroup" Width="1.5" PointX="2.75" PointY="0.75" IsExpanded="true" />
<EntityTypeShape EntityType="EEModelMain.Users" Width="1.5" PointX="2.75" PointY="3.75" IsExpanded="true" />
<EntityTypeShape EntityType="EEModelMain.vGroupUser" Width="1.5" PointX="4.75" PointY="0.75" IsExpanded="true" />
</Diagram>
</edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx>

733
Project/AdoNetEFMain.tt Normal file
View File

@@ -0,0 +1,733 @@
<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
const string inputFile = @"AdoNetEFMain.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
var fileManager = EntityFrameworkTemplateFileManager.Create(this);
var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
{
return string.Empty;
}
WriteHeader(codeStringGenerator, fileManager);
foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
{
fileManager.StartNewFile(entity.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
<#=codeStringGenerator.EntityClassOpening(entity)#>
{
<#
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
var complexProperties = typeMapper.GetComplexProperties(entity);
if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public <#=code.Escape(entity)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var navigationProperty in collectionNavigationProperties)
{
#>
this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(entity);
if (simpleProperties.Any())
{
foreach (var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var complexProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(complexProperty)#>
<#
}
}
var navigationProperties = typeMapper.GetNavigationProperties(entity);
if (navigationProperties.Any())
{
#>
<#
foreach (var navigationProperty in navigationProperties)
{
if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
{
#>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
<#
}
#>
<#=codeStringGenerator.NavigationProperty(navigationProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var complex in typeMapper.GetItemsToGenerate<ComplexType>(itemCollection))
{
fileManager.StartNewFile(complex.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
{
<#
var complexProperties = typeMapper.GetComplexProperties(complex);
var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
if (propertiesWithDefaultValues.Any() || complexProperties.Any())
{
#>
public <#=code.Escape(complex)#>()
{
<#
foreach (var edmProperty in propertiesWithDefaultValues)
{
#>
this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
<#
}
foreach (var complexProperty in complexProperties)
{
#>
this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
<#
}
#>
}
<#
}
var simpleProperties = typeMapper.GetSimpleProperties(complex);
if (simpleProperties.Any())
{
foreach(var edmProperty in simpleProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
if (complexProperties.Any())
{
#>
<#
foreach(var edmProperty in complexProperties)
{
#>
<#=codeStringGenerator.Property(edmProperty)#>
<#
}
}
#>
}
<#
EndNamespace(code);
}
foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
{
fileManager.StartNewFile(enumType.Name + ".cs");
BeginNamespace(code);
#>
<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
<#
if (typeMapper.EnumIsFlags(enumType))
{
#>
[Flags]
<#
}
#>
<#=codeStringGenerator.EnumOpening(enumType)#>
{
<#
var foundOne = false;
foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
{
foundOne = true;
#>
<#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
<#
}
if (foundOne)
{
this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
}
#>
}
<#
EndNamespace(code);
}
fileManager.Process();
#>
<#+
public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
{
fileManager.StartHeader();
#>
//------------------------------------------------------------------------------
// <auto-generated>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
//
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
// </auto-generated>
//------------------------------------------------------------------------------
<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
<#+
fileManager.EndBlock();
}
public void BeginNamespace(CodeGenerationTools code)
{
var codeNamespace = code.VsNamespaceSuggestion();
if (!String.IsNullOrEmpty(codeNamespace))
{
#>
namespace <#=code.EscapeNamespace(codeNamespace)#>
{
<#+
PushIndent(" ");
}
}
public void EndNamespace(CodeGenerationTools code)
{
if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
{
PopIndent();
#>
}
<#+
}
}
public const string TemplateId = "CSharp_DbContext_Types_EF6";
public class CodeStringGenerator
{
private readonly CodeGenerationTools _code;
private readonly TypeMapper _typeMapper;
private readonly MetadataTools _ef;
public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(typeMapper, "typeMapper");
ArgumentNotNull(ef, "ef");
_code = code;
_typeMapper = typeMapper;
_ef = ef;
}
public string Property(EdmProperty edmProperty)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
Accessibility.ForProperty(edmProperty),
_typeMapper.GetTypeName(edmProperty.TypeUsage),
_code.Escape(edmProperty),
_code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
_code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
}
public string NavigationProperty(NavigationProperty navProp)
{
var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2} {{ {3}get; {4}set; }}",
AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
_code.Escape(navProp),
_code.SpaceAfter(Accessibility.ForGetter(navProp)),
_code.SpaceAfter(Accessibility.ForSetter(navProp)));
}
public string AccessibilityAndVirtual(string accessibility)
{
return accessibility + (accessibility != "private" ? " virtual" : "");
}
public string EntityClassOpening(EntityType entity)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1}partial class {2}{3}",
Accessibility.ForType(entity),
_code.SpaceAfter(_code.AbstractOption(entity)),
_code.Escape(entity),
_code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
}
public string EnumOpening(SimpleType enumType)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} enum {1} : {2}",
Accessibility.ForType(enumType),
_code.Escape(enumType),
_code.Escape(_typeMapper.UnderlyingClrType(enumType)));
}
public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
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(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
}
}
public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"{0} IQueryable<{1}> {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
_code.Escape(edmFunction),
string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
}
public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
{
var parameters = _typeMapper.GetParameters(edmFunction);
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
_typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
edmFunction.NamespaceName,
edmFunction.Name,
string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
_code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
}
public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
if (includeMergeOption)
{
paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
}
return string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2}({3})",
AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
_code.Escape(edmFunction),
paramList);
}
public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
{
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
{
callParams = ", mergeOption" + callParams;
}
return string.Format(
CultureInfo.InvariantCulture,
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
edmFunction.Name,
callParams);
}
public string DbSet(EntitySet entitySet)
{
return string.Format(
CultureInfo.InvariantCulture,
"{0} virtual DbSet<{1}> {2} {{ get; set; }}",
Accessibility.ForReadOnlyProperty(entitySet),
_typeMapper.GetTypeName(entitySet.ElementType),
_code.Escape(entitySet));
}
public string UsingDirectives(bool inHeader, bool includeCollections = true)
{
return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
? string.Format(
CultureInfo.InvariantCulture,
"{0}using System;{1}" +
"{2}",
inHeader ? Environment.NewLine : "",
includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
inHeader ? "" : Environment.NewLine)
: "";
}
}
public class TypeMapper
{
private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
private readonly System.Collections.IList _errors;
private readonly CodeGenerationTools _code;
private readonly MetadataTools _ef;
public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
{
ArgumentNotNull(code, "code");
ArgumentNotNull(ef, "ef");
ArgumentNotNull(errors, "errors");
_code = code;
_ef = ef;
_errors = errors;
}
public static string FixNamespaces(string typeName)
{
return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
}
public string GetTypeName(TypeUsage typeUsage)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
}
public string GetTypeName(EdmType edmType)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: null);
}
public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
{
return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
}
public string GetTypeName(EdmType edmType, string modelNamespace)
{
return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
}
public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
{
if (edmType == null)
{
return null;
}
var collectionType = edmType as CollectionType;
if (collectionType != null)
{
return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
}
var typeName = _code.Escape(edmType.MetadataProperties
.Where(p => p.Name == ExternalTypeNameAttributeName)
.Select(p => (string)p.Value)
.FirstOrDefault())
?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
_code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
_code.Escape(edmType));
if (edmType is StructuralType)
{
return typeName;
}
if (edmType is SimpleType)
{
var clrType = UnderlyingClrType(edmType);
if (!IsEnumType(edmType))
{
typeName = _code.Escape(clrType);
}
typeName = FixNamespaces(typeName);
return clrType.IsValueType && isNullable == true ?
String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
typeName;
}
throw new ArgumentException("edmType");
}
public Type UnderlyingClrType(EdmType edmType)
{
ArgumentNotNull(edmType, "edmType");
var primitiveType = edmType as PrimitiveType;
if (primitiveType != null)
{
return primitiveType.ClrEquivalentType;
}
if (IsEnumType(edmType))
{
return GetEnumUnderlyingType(edmType).ClrEquivalentType;
}
return typeof(object);
}
public object GetEnumMemberValue(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var valueProperty = enumMember.GetType().GetProperty("Value");
return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
}
public string GetEnumMemberName(MetadataItem enumMember)
{
ArgumentNotNull(enumMember, "enumMember");
var nameProperty = enumMember.GetType().GetProperty("Name");
return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
}
public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var membersProperty = enumType.GetType().GetProperty("Members");
return membersProperty != null
? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
: Enumerable.Empty<MetadataItem>();
}
public bool EnumIsFlags(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
}
public bool IsEnumType(GlobalItem edmType)
{
ArgumentNotNull(edmType, "edmType");
return edmType.GetType().Name == "EnumType";
}
public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
{
ArgumentNotNull(enumType, "enumType");
return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
}
public string CreateLiteral(object value)
{
if (value == null || value.GetType() != typeof(TimeSpan))
{
return _code.CreateLiteral(value);
}
return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
}
public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
{
ArgumentNotNull(types, "types");
ArgumentNotNull(sourceFile, "sourceFile");
var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (types.Any(item => !hash.Add(item)))
{
_errors.Add(
new CompilerError(sourceFile, -1, -1, "6023",
String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
return false;
}
return true;
}
public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
{
return GetItemsToGenerate<SimpleType>(itemCollection)
.Where(e => IsEnumType(e));
}
public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
{
return itemCollection
.OfType<T>()
.Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
.OrderBy(i => i.Name);
}
public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
{
return itemCollection
.Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
.Select(g => GetGlobalItemName(g));
}
public string GetGlobalItemName(GlobalItem item)
{
if (item is EdmType)
{
return ((EdmType)item).Name;
}
else
{
return ((EntityContainer)item).Name;
}
}
public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
{
return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
}
public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type);
}
public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
{
return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
}
public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
return returnParamsProperty == null
? edmFunction.ReturnParameter
: ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
}
public bool IsComposable(EdmFunction edmFunction)
{
ArgumentNotNull(edmFunction, "edmFunction");
var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
}
public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
{
return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
}
public TypeUsage GetReturnType(EdmFunction edmFunction)
{
var returnParam = GetReturnParameter(edmFunction);
return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
}
public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
{
var returnType = GetReturnType(edmFunction);
return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
}
}
public static void ArgumentNotNull<T>(T arg, string name) where T : class
{
if (arg == null)
{
throw new ArgumentNullException(name);
}
}
#>

View File

@@ -1,70 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><Database Name="EE" Class="DataClasses1DataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
<Connection Mode="AppSettings" ConnectionString="Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser" SettingsObjectName="Project.Properties.Settings" SettingsPropertyName="gwcs" Provider="System.Data.SqlClient" />
<Table Name="dbo.UserGroup" Member="UserGroup">
<Type Name="UserGroup">
<Column Name="dept" Type="System.String" DbType="VarChar(100) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
<Column Name="gcode" Type="System.String" DbType="VarChar(10)" CanBeNull="true" />
<Column Name="path_kj" Type="System.String" DbType="NVarChar(100)" CanBeNull="true" />
<Column Name="advpurchase" Type="System.Boolean" DbType="Bit" CanBeNull="true" />
<Column Name="permission" Type="System.Int32" DbType="Int" CanBeNull="true" />
</Type>
</Table>
<Table Name="dbo.vGroupUser" Member="vGroupUser">
<Type Name="vGroupUser">
<Column Name="gcode" Type="System.String" DbType="VarChar(10) NOT NULL" CanBeNull="false" />
<Column Name="[level]" Member="level" Type="System.Int16" DbType="SmallInt" CanBeNull="true" />
<Column Name="name" Type="System.String" DbType="NVarChar(100)" CanBeNull="true" />
<Column Name="nameE" Type="System.String" DbType="NVarChar(100)" CanBeNull="true" />
<Column Name="dept" Type="System.String" DbType="VarChar(100)" CanBeNull="true" />
<Column Name="grade" Type="System.String" DbType="VarChar(10)" CanBeNull="true" />
<Column Name="email" Type="System.String" DbType="VarChar(100)" CanBeNull="true" />
<Column Name="tel" Type="System.String" DbType="VarChar(20)" CanBeNull="true" />
<Column Name="indate" Type="System.String" DbType="VarChar(20)" CanBeNull="true" />
<Column Name="outdate" Type="System.String" DbType="VarChar(20)" CanBeNull="true" />
<Column Name="hp" Type="System.String" DbType="VarChar(20)" CanBeNull="true" />
<Column Name="place" Type="System.String" DbType="VarChar(100)" CanBeNull="true" />
<Column Name="ads_employNo" Type="System.String" DbType="VarChar(50)" CanBeNull="true" />
<Column Name="ads_title" Type="System.String" DbType="NVarChar(100)" CanBeNull="true" />
<Column Name="ads_created" Type="System.String" DbType="VarChar(50)" CanBeNull="true" />
<Column Name="memo" Type="System.String" DbType="NVarChar(255)" CanBeNull="true" />
<Column Name="processs" Type="System.String" DbType="NVarChar(100)" CanBeNull="true" />
<Column Name="id" Type="System.String" DbType="VarChar(20)" CanBeNull="true" />
</Type>
</Table>
<Table Name="dbo.Users" Member="Users">
<Type Name="Users">
<Column Name="id" Type="System.String" DbType="VarChar(20) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
<Column Name="gcode" Type="System.String" DbType="VarChar(10)" CanBeNull="true" />
<Column Name="password" Type="System.String" DbType="VarChar(50)" CanBeNull="true" />
<Column Name="nameE" Type="System.String" DbType="NVarChar(100)" CanBeNull="true" />
<Column Name="name" Type="System.String" DbType="NVarChar(100)" CanBeNull="true" />
<Column Name="dept" Type="System.String" DbType="VarChar(100)" CanBeNull="true" />
<Column Name="grade" Type="System.String" DbType="VarChar(10)" CanBeNull="true" />
<Column Name="email" Type="System.String" DbType="VarChar(100)" CanBeNull="true" />
<Column Name="[level]" Member="level" Type="System.Int16" DbType="SmallInt" CanBeNull="true" />
<Column Name="indate" Type="System.String" DbType="VarChar(20)" CanBeNull="true" />
<Column Name="outdate" Type="System.String" DbType="VarChar(20)" CanBeNull="true" />
<Column Name="tel" Type="System.String" DbType="VarChar(20)" CanBeNull="true" />
<Column Name="hp" Type="System.String" DbType="VarChar(20)" CanBeNull="true" />
<Column Name="place" Type="System.String" DbType="VarChar(100)" CanBeNull="true" />
<Column Name="ads_employNo" Type="System.String" DbType="VarChar(50)" CanBeNull="true" />
<Column Name="ads_title" Type="System.String" DbType="NVarChar(100)" CanBeNull="true" />
<Column Name="ads_created" Type="System.String" DbType="VarChar(50)" CanBeNull="true" />
<Column Name="memo" Type="System.String" DbType="NVarChar(255)" CanBeNull="true" />
<Column Name="wuid" Type="System.String" DbType="VarChar(20) NOT NULL" CanBeNull="false" />
<Column Name="wdate" Type="System.DateTime" DbType="SmallDateTime NOT NULL" CanBeNull="false" />
<Column Name="processs" Type="System.String" DbType="NVarChar(100)" CanBeNull="true" />
</Type>
</Table>
<Table Name="dbo.EETGW_GroupUser" Member="EETGW_GroupUser">
<Type Name="EETGW_GroupUser">
<Column Name="idx" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
<Column Name="gcode" Type="System.String" DbType="VarChar(10) NOT NULL" CanBeNull="false" />
<Column Name="uid" Type="System.String" DbType="VarChar(20) NOT NULL" CanBeNull="false" />
<Column Name="[level]" Member="level" Type="System.Int16" DbType="SmallInt" CanBeNull="true" />
<Column Name="Process" Type="System.String" DbType="VarChar(50)" CanBeNull="true" />
<Column Name="wuid" Type="System.String" DbType="VarChar(20) NOT NULL" CanBeNull="false" />
<Column Name="wdate" Type="System.DateTime" DbType="SmallDateTime NOT NULL" CanBeNull="false" />
</Type>
</Table>
</Database>

View File

@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 11, 8.5" name="DataClasses1">
<DataContextMoniker Name="/DataClasses1DataContext" />
<nestedChildShapes>
<classShape Id="486a7958-9de9-4b1b-b914-8d09e15675ba" absoluteBounds="3, 1.125, 2, 1.7708968098958331">
<DataClassMoniker Name="/DataClasses1DataContext/UserGroup" />
<nestedChildShapes>
<elementListCompartment Id="4a357cd8-d050-4b32-958a-c51511d5a1b5" absoluteBounds="3.015, 1.585, 1.9700000000000002, 1.2108968098958333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
</nestedChildShapes>
</classShape>
<classShape Id="838b3622-14a7-484e-ba99-0c14d626efcb" absoluteBounds="5.5, 1.5, 2, 4.2708154296875">
<DataClassMoniker Name="/DataClasses1DataContext/vGroupUser" />
<nestedChildShapes>
<elementListCompartment Id="8dd6b41e-f39d-4833-a216-88cdea23b90b" absoluteBounds="5.515, 1.96, 1.9700000000000002, 3.7108154296875" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
</nestedChildShapes>
</classShape>
<classShape Id="e31194d4-dbfc-43be-a990-631a80608c92" absoluteBounds="0.875, 1.625, 2, 4.8477197265625">
<DataClassMoniker Name="/DataClasses1DataContext/Users" />
<nestedChildShapes>
<elementListCompartment Id="52fa12b5-277e-4bfd-9f56-b4ab546c5ba6" absoluteBounds="0.89000000000000012, 2.085, 1.9700000000000002, 4.2877197265625" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
</nestedChildShapes>
</classShape>
<classShape Id="67aa0d78-d2b2-48d3-8222-95fb2aa74729" absoluteBounds="3.375, 3.375, 2, 2.1554996744791666">
<DataClassMoniker Name="/DataClasses1DataContext/EETGW_GroupUser" />
<nestedChildShapes>
<elementListCompartment Id="37147d17-6849-4a80-9c7c-bce471e8fdd5" absoluteBounds="3.39, 3.835, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
</nestedChildShapes>
</classShape>
</nestedChildShapes>
</ordesignerObjectsDiagram>

File diff suppressed because it is too large Load Diff

View File

@@ -124,6 +124,12 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\ArSetting.Net4.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="FarPoint.Localization, Version=11.40.20177.0, Culture=neutral, PublicKeyToken=327c3516b1b18457, processorArchitecture=MSIL" />
<Reference Include="FarPoint.Win, Version=11.40.20177.0, Culture=neutral, PublicKeyToken=327c3516b1b18457, processorArchitecture=MSIL" />
<Reference Include="FarPoint.Win.Spread, Version=11.40.20177.0, Culture=neutral, PublicKeyToken=327c3516b1b18457, processorArchitecture=MSIL" />
@@ -134,12 +140,15 @@
<Reference Include="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
<Reference Include="Microsoft.ReportViewer.WinForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Management" />
<Reference Include="System.Net" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Services" />
@@ -157,12 +166,22 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CResult.cs" />
<Compile Include="DataClasses1.designer.cs">
<Compile Include="AdoNetEFMain.Context.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>DataClasses1.dbml</DependentUpon>
<DependentUpon>AdoNetEFMain.Context.tt</DependentUpon>
</Compile>
<Compile Include="AdoNetEFMain.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
</Compile>
<Compile Include="AdoNetEFMain.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>AdoNetEFMain.edmx</DependentUpon>
</Compile>
<Compile Include="CResult.cs" />
<Compile Include="DataSet1.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -227,6 +246,9 @@
<DesignTime>True</DesignTime>
<DependentUpon>DsPMPDatabase.xsd</DependentUpon>
</Compile>
<Compile Include="EETGW_GroupUser.cs">
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
</Compile>
<Compile Include="fLog.cs">
<SubType>Form</SubType>
</Compile>
@@ -252,6 +274,15 @@
<Compile Include="MessageWindow.cs" />
<Compile Include="MethodExtentions.cs" />
<Compile Include="Program.cs" />
<Compile Include="UserGroup.cs">
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
</Compile>
<Compile Include="Users.cs">
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
</Compile>
<Compile Include="vGroupUser.cs">
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
</Compile>
<Compile Include="_Common\fADSUserList.cs">
<SubType>Form</SubType>
</Compile>
@@ -378,15 +409,14 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EntityDeploy Include="AdoNetEFMain.edmx">
<Generator>EntityModelCodeGenerator</Generator>
<LastGenOutput>AdoNetEFMain.Designer.cs</LastGenOutput>
</EntityDeploy>
<None Include="AdoNetEFMain.edmx.diagram">
<DependentUpon>AdoNetEFMain.edmx</DependentUpon>
</None>
<None Include="app.config" />
<None Include="DataClasses1.dbml">
<Generator>MSLinqToSQLGenerator</Generator>
<LastGenOutput>DataClasses1.designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</None>
<None Include="DataClasses1.dbml.layout">
<DependentUpon>DataClasses1.dbml</DependentUpon>
</None>
<None Include="DataSet1.xsc">
<DependentUpon>DataSet1.xsd</DependentUpon>
</None>
@@ -420,6 +450,7 @@
<None Include="DsPMPDatabase.xss">
<DependentUpon>DsPMPDatabase.xsd</DependentUpon>
</None>
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -435,6 +466,16 @@
</None>
</ItemGroup>
<ItemGroup>
<Content Include="AdoNetEFMain.Context.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<DependentUpon>AdoNetEFMain.edmx</DependentUpon>
<LastGenOutput>AdoNetEFMain.Context.cs</LastGenOutput>
</Content>
<Content Include="AdoNetEFMain.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<DependentUpon>AdoNetEFMain.edmx</DependentUpon>
<LastGenOutput>AdoNetEFMain.cs</LastGenOutput>
</Content>
<Content Include="History.txt" />
<Content Include="icons8-realtime-64.ico" />
<Content Include="libxl.dll">
@@ -509,6 +550,7 @@
</ItemGroup>
<ItemGroup>
<Service Include="{3259AA49-8AA1-44D3-9025-A0B520596A8C}" />
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 템플릿에서 생성되었습니다.
//
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Project
{
using System;
using System.Collections.Generic;
public partial class EETGW_GroupUser
{
public int idx { get; set; }
public string gcode { get; set; }
public string uid { get; set; }
public Nullable<short> level { get; set; }
public string Process { get; set; }
public string wuid { get; set; }
public System.DateTime wdate { get; set; }
}
}

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
// 지정되도록 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("20.10.27.1200")]
[assembly: AssemblyFileVersion("20.10.27.1200")]
[assembly: AssemblyVersion("20.10.29.1100")]
[assembly: AssemblyFileVersion("20.10.29.1100")]

View File

@@ -34,20 +34,6 @@ namespace Project.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("using System; \r\nnamespace HelloWorld \r\n{ \r\n public static class HelloWorldCla" +
"ss \r\n { \r\n public static string test() \r\n { \r\n " +
" return {0};\r\n } \r\n } \r\n};")]
public string nilliila {
get {
return ((string)(this["nilliila"]));
}
set {
this["nilliila"] = value;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]

View File

@@ -10,19 +10,6 @@
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=Amkor123!</Value>
</Setting>
<Setting Name="nilliila" Type="System.String" Scope="User">
<Value Profile="(Default)">using System;
namespace HelloWorld
{
public static class HelloWorldClass
{
public static string test()
{
return {0};
}
}
};</Value>
</Setting>
<Setting Name="PMPCS" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;

23
Project/UserGroup.cs Normal file
View File

@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 템플릿에서 생성되었습니다.
//
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Project
{
using System;
using System.Collections.Generic;
public partial class UserGroup
{
public string dept { get; set; }
public string gcode { get; set; }
public string path_kj { get; set; }
public Nullable<bool> advpurchase { get; set; }
public Nullable<int> permission { get; set; }
}
}

39
Project/Users.cs Normal file
View File

@@ -0,0 +1,39 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 템플릿에서 생성되었습니다.
//
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Project
{
using System;
using System.Collections.Generic;
public partial class Users
{
public string id { get; set; }
public string gcode { get; set; }
public string password { get; set; }
public string nameE { get; set; }
public string name { get; set; }
public string dept { get; set; }
public string grade { get; set; }
public string email { get; set; }
public Nullable<short> level { get; set; }
public string indate { get; set; }
public string outdate { get; set; }
public string tel { get; set; }
public string hp { get; set; }
public string place { get; set; }
public string ads_employNo { get; set; }
public string ads_title { get; set; }
public string ads_created { get; set; }
public string memo { get; set; }
public string wuid { get; set; }
public System.DateTime wdate { get; set; }
public string processs { get; set; }
}
}

View File

@@ -34,7 +34,7 @@ namespace Project._Common
return;
}
var db = new DataClasses1DataContext();
var db = new EEEntitiesMain();
var dr_user = db.Users.Where(t => t.id == id).FirstOrDefault();
if (dr_user == null)
{
@@ -71,7 +71,7 @@ namespace Project._Common
private void button2_Click(object sender, EventArgs e)
{
this.Validate();
var db = new DataClasses1DataContext();
var db = new EEEntitiesMain();
//해당 그룹에 데이터를 추가한다.
var drDept = db.UserGroup.Where(t => t.dept == tbDept.Text).FirstOrDefault();
@@ -98,11 +98,12 @@ namespace Project._Common
drGuser.uid = this.tbId.Text.Trim();
drGuser.Process = this.tbProcess.Text.Trim();
db.EETGW_GroupUser.InsertOnSubmit(drGuser);
//db.EETGW_GroupUser.InsertOnSubmit(drGuser);
db.EETGW_GroupUser.Add(drGuser);
}
//사용자 목록에 없다면 추가한다
var drUser = db.Users.Where(t => t.id == tbId.Text.Trim()).FirstOrDefault();
var drUser = db.Users.SingleOrDefault(t => t.id == tbId.Text.Trim());
if(drUser == null)
{
drUser = new Users();
@@ -122,7 +123,7 @@ namespace Project._Common
drUser.outdate = tbDateO.Text;
drUser.memo = tbMemo.Text;
drUser.processs = tbProcess.Text;
db.Users.InsertOnSubmit(drUser);
db.Users.Add(drUser);
}
else
@@ -136,9 +137,9 @@ namespace Project._Common
drUser.indate = tbDateIn.Text;
drUser.outdate = tbDateO.Text;
drUser.memo = tbMemo.Text;
drUser.processs = tbProcess.Text;
drUser.processs = tbProcess.Text;
}
db.SubmitChanges();
db.SaveChanges();
this.DialogResult = DialogResult.OK;
}

View File

@@ -63,7 +63,7 @@ namespace Project._Common
}
//부서목록 업데이트
var db = new DataClasses1DataContext();
var db = new EEEntitiesMain();
var GrpList = db.UserGroup.Where(t => t.gcode != null && t.permission != null && t.gcode != "" && t.permission > 0);
//var tagrp = new dsMSSQLTableAdapters.UserGroupTableAdapter();
@@ -176,7 +176,7 @@ namespace Project._Common
if (tbProcess.Text.Trim() == "") tbProcess.Text = "%";
this.dsMSSQL.Users.Clear();
var db = new DataClasses1DataContext();
var db = new EEEntitiesMain();
if (tbProcess.Text.Trim() != "" && tbProcess.Text.Trim() != "%")
this.bs.DataSource = db.vGroupUser.Where(t => t.dept == this.cmbdept.Text && t.processs.Contains(tbProcess.Text.Trim()));
else

View File

@@ -1,43 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Project.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<connectionStrings>
<add name="Project.Properties.Settings.gwcs" connectionString="Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=Amkor123!"
providerName="System.Data.SqlClient" />
<add name="Project.Properties.Settings.PMPCS" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Temp\PMP\SPMaster.mdb"
providerName="System.Data.OleDb" />
</connectionStrings>
<userSettings>
<Project.Properties.Settings>
<setting name="nilliila" serializeAs="String">
<value>using System;
namespace HelloWorld
{
public static class HelloWorldClass
{
public static string test()
{
return {0};
}
}
};</value>
</setting>
</Project.Properties.Settings>
</userSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="Project.Properties.Settings.gwcs" connectionString="Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=Amkor123!" providerName="System.Data.SqlClient" />
<add name="Project.Properties.Settings.PMPCS" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Temp\PMP\SPMaster.mdb" providerName="System.Data.OleDb" /><add name="EEEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=10.131.15.18;initial catalog=EE;persist security info=True;user id=eeuser;password=Amkor123!;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /><add name="EEEntities1" connectionString="metadata=res://*/ModelMain.csdl|res://*/ModelMain.ssdl|res://*/ModelMain.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=10.131.15.18;initial catalog=EE;user id=eeuser;password=Amkor123!;connect timeout=30;encrypt=False;trustservercertificate=False;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /><add name="EEEntitiesMain" connectionString="metadata=res://*/AdoNetEFMain.csdl|res://*/AdoNetEFMain.ssdl|res://*/AdoNetEFMain.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=10.131.15.18;initial catalog=EE;user id=eeuser;password=Amkor123!;connect timeout=30;encrypt=False;trustservercertificate=False;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup></configuration>

5
Project/packages.config Normal file
View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.2.0" targetFramework="net45" />
<package id="EntityFramework.ko" version="6.2.0" targetFramework="net45" />
</packages>

36
Project/vGroupUser.cs Normal file
View File

@@ -0,0 +1,36 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 템플릿에서 생성되었습니다.
//
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Project
{
using System;
using System.Collections.Generic;
public partial class vGroupUser
{
public string gcode { get; set; }
public string dept { get; set; }
public Nullable<short> level { get; set; }
public string name { get; set; }
public string nameE { get; set; }
public string grade { get; set; }
public string email { get; set; }
public string tel { get; set; }
public string indate { get; set; }
public string outdate { get; set; }
public string hp { get; set; }
public string place { get; set; }
public string ads_employNo { get; set; }
public string ads_title { get; set; }
public string ads_created { get; set; }
public string memo { get; set; }
public string processs { get; set; }
public string id { get; set; }
}
}