migratino complete
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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<UserGroup> UserGroup { get; set; }
|
||||
public virtual DbSet<EETGW_LoginInfo> EETGW_LoginInfo { get; set; }
|
||||
public virtual DbSet<Users> Users { get; set; }
|
||||
public virtual DbSet<EETGW_GroupUser> EETGW_GroupUser { get; set; }
|
||||
public virtual DbSet<vGroupUser> vGroupUser { get; set; }
|
||||
public virtual DbSet<EETGW_JobReport_AutoInput> EETGW_JobReport_AutoInput { get; set; }
|
||||
public virtual DbSet<JobReport> JobReport { get; set; }
|
||||
public virtual DbSet<vFindSID> vFindSID { get; set; }
|
||||
public virtual DbSet<Projects> Projects { get; set; }
|
||||
public virtual DbSet<ProjectsHistory> ProjectsHistory { get; set; }
|
||||
public virtual DbSet<ProjectsIOMap> ProjectsIOMap { get; set; }
|
||||
public virtual DbSet<ProjectsMailList> ProjectsMailList { get; set; }
|
||||
public virtual DbSet<ProjectsPart> ProjectsPart { get; set; }
|
||||
public virtual DbSet<Purchase> Purchase { get; set; }
|
||||
public virtual DbSet<HolidayLIst> HolidayLIst { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,636 +0,0 @@
|
||||
<#@ 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
10
Project/AdoNetEFMain.Designer.cs
generated
@@ -1,10 +0,0 @@
|
||||
// 모델 'D:\Source\##### 완료아이템\(0014) GroupWare\Source\Project\AdoNetEFMain.edmx'에 대해 T4 코드 생성이 사용됩니다.
|
||||
// 레거시 코드 생성을 사용하려면 '코드 생성 전략' 디자이너 속성의 값을
|
||||
// 'Legacy ObjectContext'로 변경하십시오. 이 속성은 모델이 디자이너에서 열릴 때
|
||||
// 속성 창에서 사용할 수 있습니다.
|
||||
|
||||
// 컨텍스트 및 엔터티 클래스가 생성되지 않은 경우 빈 모델을 만들었기 때문일 수도 있지만
|
||||
// 사용할 Entity Framework 버전을 선택하지 않았기 때문일 수도 있습니다. 모델에 맞는 컨텍스트 클래스 및
|
||||
// 엔터티 클래스를 생성하려면 디자이너에서 모델을 열고 디자이너 화면에서 마우스 오른쪽 단추를 클릭한
|
||||
// 다음 '데이터베이스에서 모델 업데이트...', '모델에서 데이터베이스 생성...' 또는 '코드 생성 항목 추가...'를
|
||||
// 선택하십시오.
|
||||
@@ -1,9 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,26 +0,0 @@
|
||||
<?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.UserGroup" Width="1.5" PointX="11.375" PointY="1" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EEModelMain.EETGW_LoginInfo" Width="1.5" PointX="7.5" PointY="0.5" />
|
||||
<EntityTypeShape EntityType="EEModelMain.Users" Width="1.5" PointX="8.875" PointY="0.75" />
|
||||
<EntityTypeShape EntityType="EEModelMain.EETGW_GroupUser" Width="2.125" PointX="0.75" PointY="0.75" />
|
||||
<EntityTypeShape EntityType="EEModelMain.vGroupUser" Width="1.5" PointX="3.375" PointY="0.75" />
|
||||
<EntityTypeShape EntityType="EEModelMain.EETGW_JobReport_AutoInput" Width="1.5" PointX="0.75" PointY="4.75" />
|
||||
<EntityTypeShape EntityType="EEModelMain.JobReport" Width="1.5" PointX="5.375" PointY="3.75" />
|
||||
<EntityTypeShape EntityType="EEModelMain.vFindSID" Width="1.5" PointX="7.375" PointY="6.75" />
|
||||
<EntityTypeShape EntityType="EEModelMain.Projects" Width="1.5" PointX="3.75" PointY="9.75" />
|
||||
<EntityTypeShape EntityType="EEModelMain.ProjectsHistory" Width="1.5" PointX="9.75" PointY="6.75" />
|
||||
<EntityTypeShape EntityType="EEModelMain.ProjectsIOMap" Width="1.5" PointX="9.75" PointY="10.75" />
|
||||
<EntityTypeShape EntityType="EEModelMain.ProjectsMailList" Width="1.5" PointX="0.75" PointY="11.75" />
|
||||
<EntityTypeShape EntityType="EEModelMain.ProjectsPart" Width="1.5" PointX="11.75" PointY="3.75" />
|
||||
<EntityTypeShape EntityType="EEModelMain.Purchase" Width="1.5" PointX="5.75" PointY="11.75" />
|
||||
<EntityTypeShape EntityType="EEModelMain.HolidayLIst" Width="1.5" PointX="12.375" PointY="11.75" />
|
||||
</Diagram>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
</edmx:Edmx>
|
||||
@@ -1,733 +0,0 @@
|
||||
<#@ 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);
|
||||
}
|
||||
}
|
||||
#>
|
||||
@@ -49,8 +49,8 @@ namespace Project
|
||||
var itemcnt = 0;
|
||||
if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new EEEntitiesCommon();
|
||||
var rows = db.Customs.Where(t => t.gcode == FCOMMON.info.Login.gcode).OrderBy(t => t.name);
|
||||
var db = new dsMSSQLTableAdapters.CustomsTableAdapter();//.custrom EEEntitiesCommon();
|
||||
var rows = db.GetData(FCOMMON.info.Login.gcode);// db.Customs.Where(t => t.gcode == FCOMMON.info.Login.gcode).OrderBy(t => t.name);
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
@@ -138,9 +138,9 @@ namespace Project
|
||||
var itemcnt = 0;
|
||||
//if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new EEEntitiesCommon();
|
||||
var db = new dsMSSQLTableAdapters.CustomsTableAdapter();// EEEntitiesCommon();
|
||||
var sd = DateTime.Now.ToString("yyyy-MM-01");
|
||||
var rows = db.Customs.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode).OrderBy(t=>t.name);
|
||||
var rows = db.GetData(FCOMMON.info.Login.gcode);// .Customs.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode).OrderBy(t=>t.name);
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -43,6 +44,11 @@ namespace Project
|
||||
//기본값을 찾아서 없애줘야한다
|
||||
var searchkey = string.Empty;
|
||||
if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim();
|
||||
if (searchkey.isEmpty() == false && searchkey != "%")
|
||||
{
|
||||
if (searchkey.StartsWith("%") == false) searchkey = "%" + searchkey;
|
||||
if (searchkey.EndsWith("%") == false) searchkey = searchkey + "%";
|
||||
}
|
||||
|
||||
var tbody = new System.Text.StringBuilder();
|
||||
|
||||
@@ -50,8 +56,8 @@ namespace Project
|
||||
var itemcnt = 0;
|
||||
if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new EEEntitiesMain();
|
||||
var rows = db.vFindSID.Where(t => t.sid.Contains(searchkey) || t.name.Contains(searchkey) || t.model.Contains(searchkey));
|
||||
var db = new dsMSSQLTableAdapters.vFindSIDTableAdapter();// EEEntitiesMain();
|
||||
var rows = db.GetData(searchkey);// .vFindSID.Where(t => t.sid.Contains(searchkey) || t.name.Contains(searchkey) || t.model.Contains(searchkey));
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
@@ -61,15 +67,15 @@ namespace Project
|
||||
tbody.AppendLine($"<td>{item.name}</td>");
|
||||
tbody.AppendLine($"<td>{item.model}</td>");
|
||||
|
||||
if (item.price == null)
|
||||
if (item.IspriceNull())
|
||||
tbody.AppendLine($"<td>--</td>");
|
||||
else
|
||||
{
|
||||
var price = (double)item.price / 1000.0;
|
||||
|
||||
|
||||
tbody.AppendLine($"<td>{price.ToString("N0")}</td>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
tbody.AppendLine($"<td>{item.manu}</td>");
|
||||
tbody.AppendLine($"<td>{item.supply}</td>");
|
||||
|
||||
@@ -68,10 +68,10 @@ namespace Project
|
||||
var tbody = new System.Text.StringBuilder();
|
||||
|
||||
//테이블데이터생성
|
||||
var db = new EEEntitiesJobreport();
|
||||
var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();//. EEEntitiesJobreport();
|
||||
var sd = DateTime.Now.ToString("yyyy-MM-01");
|
||||
var ed = DateTime.Now.ToShortDateString();
|
||||
var rows = db.vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == id).FirstOrDefault();
|
||||
var rows = db.GetData(FCOMMON.info.Login.gcode, id).FirstOrDefault();//.vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == id).FirstOrDefault();
|
||||
|
||||
var contents = result.Content;
|
||||
if (rows == null)
|
||||
@@ -140,10 +140,11 @@ namespace Project
|
||||
var itemcnt = 0;
|
||||
//if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new EEEntitiesJobreport();
|
||||
var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();// EEEntitiesJobreport();
|
||||
var sd = DateTime.Now.ToString("yyyy-MM-01");
|
||||
var ed = DateTime.Now.ToShortDateString();
|
||||
var rows = db.vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.id == FCOMMON.info.Login.no && t.pdate.CompareTo(sd) >= 0 && t.pdate.CompareTo(ed) <= 1).OrderByDescending(t => t.pdate);
|
||||
var rows = db.GetByDate(FCOMMON.info.Login.gcode, FCOMMON.info.Login.no, sd, ed);
|
||||
//vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.id == FCOMMON.info.Login.no && t.pdate.CompareTo(sd) >= 0 && t.pdate.CompareTo(ed) <= 1).OrderByDescending(t => t.pdate);
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
@@ -228,9 +229,9 @@ namespace Project
|
||||
var itemcnt = 0;
|
||||
if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new EEEntitiesJobreport();
|
||||
var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();// EEEntitiesJobreport();
|
||||
var sd = DateTime.Now.ToShortDateString();
|
||||
var rows = db.vJobReportForUser.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate.CompareTo(sd) == 0).OrderBy(t => t.name);
|
||||
var rows = db.GetByToday(FCOMMON.info.Login.gcode, sd);//.vJobReportForUser.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate.CompareTo(sd) == 0).OrderBy(t => t.name);
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
@@ -309,10 +310,11 @@ namespace Project
|
||||
var itemcnt = 0;
|
||||
//if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new EEEntitiesJobreport();
|
||||
var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();// EEEntitiesJobreport();
|
||||
var sd = DateTime.Now.ToShortDateString();
|
||||
var ed = DateTime.Now.ToShortDateString();
|
||||
var rows = db.vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.id == FCOMMON.info.Login.no && t.pdate.CompareTo(sd) >= 0 && t.pdate.CompareTo(ed) <= 1).OrderByDescending(t => t.pdate);
|
||||
var rows = db.GetByDate(FCOMMON.info.Login.gcode, FCOMMON.info.Login.no, sd, ed);
|
||||
//.vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.id == FCOMMON.info.Login.no && t.pdate.CompareTo(sd) >= 0 && t.pdate.CompareTo(ed) <= 1).OrderByDescending(t => t.pdate);
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
|
||||
@@ -50,25 +50,25 @@ namespace Project
|
||||
var itemcnt = 0;
|
||||
if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new EEEntitiesProject();
|
||||
//var db = new EEEntitiesProject();
|
||||
|
||||
|
||||
var rows = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
|
||||
//var rows = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
|
||||
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine($"<th scope='row'>{item.pdate}</th>");
|
||||
tbody.AppendLine($"<td>{item.name}</td>");
|
||||
//itemcnt = rows.Count();
|
||||
//foreach (var item in rows)
|
||||
//{
|
||||
// tbody.AppendLine("<tr>");
|
||||
// tbody.AppendLine($"<th scope='row'>{item.pdate}</th>");
|
||||
// tbody.AppendLine($"<td>{item.name}</td>");
|
||||
|
||||
|
||||
//if (item.description.Length > 10)
|
||||
// tbody.AppendLine($"<td>{item.description.Substring(0, 10)}...</td>");
|
||||
//else
|
||||
// tbody.AppendLine($"<td>{item.description}</td>");
|
||||
tbody.AppendLine("</tr>");
|
||||
}
|
||||
// //if (item.description.Length > 10)
|
||||
// // tbody.AppendLine($"<td>{item.description.Substring(0, 10)}...</td>");
|
||||
// //else
|
||||
// // tbody.AppendLine($"<td>{item.description}</td>");
|
||||
// tbody.AppendLine("</tr>");
|
||||
//}
|
||||
}
|
||||
|
||||
//아잍쳄이 없는경우
|
||||
@@ -114,9 +114,11 @@ namespace Project
|
||||
var project = (int)id;
|
||||
|
||||
//데이터를 조회해서 표시를 해준다.
|
||||
var db = new EEEntitiesProject();
|
||||
var prjinfo = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == project).FirstOrDefault();
|
||||
var schrows = db.EETGW_ProjectsSchedule.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.project == project).OrderByDescending(t => t.project).OrderByDescending(t => t.no).OrderBy(t => t.seq);
|
||||
var db = new dsProjectsTableAdapters.ProjectsTableAdapter();// EEEntitiesProject();
|
||||
var prjinfo = db.GetData(FCOMMON.info.Login.gcode, project).FirstOrDefault();// db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == project).FirstOrDefault();
|
||||
|
||||
var taSch = new dsProjectsTableAdapters.EETGW_ProjectsScheduleTableAdapter();
|
||||
var schrows = taSch.GetData(FCOMMON.info.Login.gcode, project);//. db.EETGW_ProjectsSchedule.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.project == project).OrderByDescending(t => t.project).OrderByDescending(t => t.no).OrderBy(t => t.seq);
|
||||
|
||||
var gets = Request.GetQueryNameValuePairs();// GetParameters(data);
|
||||
|
||||
@@ -197,10 +199,10 @@ namespace Project
|
||||
//if (searchkey.isEmpty() == false)
|
||||
{
|
||||
|
||||
var db = new EEEntitiesProject();
|
||||
var db = new dsProjectsTableAdapters.ProjectsTableAdapter();// EEEntitiesProject();
|
||||
|
||||
|
||||
var rows = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
|
||||
var rows = db.GetNotCompleteTop50(FCOMMON.info.Login.gcode);//.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
|
||||
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
@@ -290,10 +292,10 @@ namespace Project
|
||||
//if (searchkey.isEmpty() == false)
|
||||
{
|
||||
|
||||
var db = new EEEntitiesProject();
|
||||
var db = new dsProjectsTableAdapters.ProjectsTableAdapter();// EEEntitiesProject();
|
||||
|
||||
|
||||
var rows = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
|
||||
var rows = db.GetNotCompleteTop50(FCOMMON.info.Login.gcode);// db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
|
||||
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
@@ -388,9 +390,9 @@ namespace Project
|
||||
//if (searchkey.isEmpty() == false)
|
||||
{
|
||||
|
||||
var db = new EEEntitiesProject();
|
||||
var db = new dsProjectsTableAdapters.ProjectsTableAdapter();// EEEntitiesProject();
|
||||
|
||||
var prjinfo = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == id).FirstOrDefault();
|
||||
var prjinfo = db.GetData(FCOMMON.info.Login.gcode, id).FirstOrDefault();// db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == id).FirstOrDefault();
|
||||
System.Text.StringBuilder tinfo = new System.Text.StringBuilder();
|
||||
//프로젝트정보를 표시합니다.
|
||||
tinfo.AppendLine("<tr>");
|
||||
@@ -405,8 +407,8 @@ namespace Project
|
||||
|
||||
contents = contents.Replace("{tableinfo}", tinfo.ToString());
|
||||
|
||||
|
||||
var rows = db.ProjectsPart.Where(t => t.Project == id).OrderBy(t=>t.no);
|
||||
var taPart = new dsProjectsTableAdapters.ProjectsPartTableAdapter();
|
||||
var rows = taPart.GetData(id);// db.ProjectsPart.Where(t => t.Project == id).OrderBy(t=>t.no);
|
||||
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -44,14 +45,20 @@ namespace Project
|
||||
var searchkey = string.Empty;
|
||||
if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim();
|
||||
|
||||
if(searchkey.isEmpty()==false && searchkey != "%")
|
||||
{
|
||||
if (searchkey.StartsWith("%") == false) searchkey = "%" + searchkey;
|
||||
if (searchkey.EndsWith("%") == false) searchkey += "%";
|
||||
}
|
||||
|
||||
var tbody = new System.Text.StringBuilder();
|
||||
|
||||
//테이블데이터생성
|
||||
var itemcnt = 0;
|
||||
if (searchkey.isEmpty() == false)
|
||||
{
|
||||
var db = new EEEntitiesMain();
|
||||
var rows = db.vFindSID.Where(t => t.sid.Contains(searchkey) || t.name.Contains(searchkey) || t.manu.Contains(searchkey) || t.model.Contains(searchkey));
|
||||
var db = new dsMSSQLTableAdapters.vFindSIDTableAdapter();// EEEntitiesMain();
|
||||
var rows = db.GetData(searchkey);//.vFindSID.Where(t => t.sid.Contains(searchkey) || t.name.Contains(searchkey) || t.manu.Contains(searchkey) || t.model.Contains(searchkey));
|
||||
itemcnt = rows.Count();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
@@ -61,7 +68,7 @@ namespace Project
|
||||
tbody.AppendLine($"<td>{item.name}</td>");
|
||||
tbody.AppendLine($"<td>{item.model}</td>");
|
||||
|
||||
if (item.price == null)
|
||||
if (item.IspriceNull())
|
||||
tbody.AppendLine($"<td>--</td>");
|
||||
else
|
||||
{
|
||||
@@ -139,11 +146,11 @@ namespace Project
|
||||
var itemcnt = 0;
|
||||
//if (searchkey.isEmpty() == false)
|
||||
//{
|
||||
var db = new EEEntitiesPurchase();
|
||||
var db = new dsMSSQLTableAdapters.vPurchaseTableAdapter();// EEEntitiesPurchase();
|
||||
var sd = DateTime.Now.ToString("yyyy-MM-01");
|
||||
var rows = db.vPurchase.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate.CompareTo(sd) >= 0).OrderByDescending(t => t.pdate);
|
||||
var rows = db.GetAfter(FCOMMON.info.Login.gcode, sd);// .vPurchase.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate.CompareTo(sd) >= 0).OrderByDescending(t => t.pdate);
|
||||
itemcnt = rows.Count();
|
||||
foreach (vPurchase item in rows)
|
||||
foreach (var item in rows)
|
||||
{
|
||||
tbody.AppendLine("<tr>");
|
||||
tbody.AppendLine($"<th scope='row'>{item.pdate.Substring(5)}</th>");
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Customs
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public string gcode { get; set; }
|
||||
public string grp { get; set; }
|
||||
public string uptae { get; set; }
|
||||
public string name { get; set; }
|
||||
public string name2 { get; set; }
|
||||
public string owner { get; set; }
|
||||
public string ownertel { get; set; }
|
||||
public string address { get; set; }
|
||||
public string tel { get; set; }
|
||||
public string fax { get; set; }
|
||||
public string email { get; set; }
|
||||
public string memo { get; set; }
|
||||
public string staff { get; set; }
|
||||
public string stafftel { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,10 @@
|
||||
<xs:schema id="DSMail" targetNamespace="http://tempuri.org/DSMail.xsd" xmlns:mstns="http://tempuri.org/DSMail.xsd" xmlns="http://tempuri.org/DSMail.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
|
||||
<xs:annotation>
|
||||
<xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<DataSource DefaultConnectionIndex="1" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<Connections>
|
||||
<Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="gwcs" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="gwcs (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.Project.Properties.Settings.GlobalReference.Default.gwcs" Provider="System.Data.SqlClient" />
|
||||
<Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="CS" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="CS (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.Project.Properties.Settings.GlobalReference.Default.gwcs" Provider="System.Data.SqlClient" />
|
||||
</Connections>
|
||||
<Tables>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="MailFormTableAdapter" GeneratorDataComponentClassName="MailFormTableAdapter" Name="MailForm" UserDataComponentName="MailFormTableAdapter">
|
||||
@@ -481,7 +482,7 @@ WHERE (gcode = @gcode) AND (project = @project)</CommandText>
|
||||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="vJobReportForUserTableAdapter" GeneratorDataComponentClassName="vJobReportForUserTableAdapter" Name="vJobReportForUser" UserDataComponentName="vJobReportForUserTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="gwcs (Settings)" DbObjectName="EE.dbo.vJobReportForUser" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<DbSource ConnectionRef="CS (Settings)" DbObjectName="EE.dbo.vJobReportForUser" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="true">
|
||||
<CommandText>SELECT id, MAX(name) AS name
|
||||
@@ -665,7 +666,7 @@ SELECT idx, pdate, free, memo, wuid, wdate FROM HolidayLIst WHERE (idx = @idx)</
|
||||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="vGroupUserTableAdapter" GeneratorDataComponentClassName="vGroupUserTableAdapter" Name="vGroupUser" UserDataComponentName="vGroupUserTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="gwcs (Settings)" DbObjectName="EE.dbo.vGroupUser" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<DbSource ConnectionRef="CS (Settings)" DbObjectName="EE.dbo.vGroupUser" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="false">
|
||||
<CommandText>SELECT gcode, dept, level, name, nameE, grade, email, tel, indate, outdate, hp, place, ads_employNo, ads_title, ads_created, memo, processs, id, state, useJobReport, useUserState, password
|
||||
@@ -703,7 +704,7 @@ WHERE (gcode = @gcode)</CommandText>
|
||||
<Mapping SourceColumn="password" DataSetColumn="password" />
|
||||
</Mappings>
|
||||
<Sources>
|
||||
<DbSource ConnectionRef="gwcs (Settings)" DbObjectName="EE.dbo.vGroupUser" DbObjectType="View" FillMethodModifier="Public" FillMethodName="FillByID" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetyByID" GeneratorSourceName="FillByID" GetMethodModifier="Public" GetMethodName="GetyByID" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetyByID" UserSourceName="FillByID">
|
||||
<DbSource ConnectionRef="CS (Settings)" DbObjectName="EE.dbo.vGroupUser" DbObjectType="View" FillMethodModifier="Public" FillMethodName="FillByID" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetyByID" GeneratorSourceName="FillByID" GetMethodModifier="Public" GetMethodName="GetyByID" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetyByID" UserSourceName="FillByID">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="Text" ModifiedByUser="true">
|
||||
<CommandText>SELECT gcode, dept, level, name, nameE, grade, email, tel, indate, outdate, hp, place, ads_employNo, ads_title, ads_created, memo, processs, id, state, useJobReport, useUserState, password
|
||||
@@ -747,13 +748,13 @@ ORDER BY pdate</CommandText>
|
||||
</DataSource>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
<xs:element name="DSMail" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_UserDSName="DSMail" msprop:Generator_DataSetName="DSMail">
|
||||
<xs:element name="DSMail" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="DSMail" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="DSMail">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="MailForm" msprop:Generator_RowClassName="MailFormRow" msprop:Generator_RowEvHandlerName="MailFormRowChangeEventHandler" msprop:Generator_RowDeletedName="MailFormRowDeleted" msprop:Generator_RowDeletingName="MailFormRowDeleting" msprop:Generator_RowEvArgName="MailFormRowChangeEvent" msprop:Generator_TablePropName="MailForm" msprop:Generator_RowChangedName="MailFormRowChanged" msprop:Generator_RowChangingName="MailFormRowChanging" msprop:Generator_TableClassName="MailFormDataTable" msprop:Generator_UserTableName="MailForm" msprop:Generator_TableVarName="tableMailForm">
|
||||
<xs:element name="MailForm" msprop:Generator_RowEvHandlerName="MailFormRowChangeEventHandler" msprop:Generator_RowDeletedName="MailFormRowDeleted" msprop:Generator_RowDeletingName="MailFormRowDeleting" msprop:Generator_RowEvArgName="MailFormRowChangeEvent" msprop:Generator_TablePropName="MailForm" msprop:Generator_RowChangedName="MailFormRowChanged" msprop:Generator_UserTableName="MailForm" msprop:Generator_RowChangingName="MailFormRowChanging" msprop:Generator_RowClassName="MailFormRow" msprop:Generator_TableClassName="MailFormDataTable" msprop:Generator_TableVarName="tableMailForm">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnVarNameInTable="columnidx" msprop:Generator_UserColumnName="idx" type="xs:int" />
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnVarNameInTable="columnidx" type="xs:int" />
|
||||
<xs:element name="gcode" msprop:Generator_ColumnPropNameInTable="gcodeColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="gcode" msprop:Generator_UserColumnName="gcode" msprop:Generator_ColumnVarNameInTable="columngcode">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
@@ -820,14 +821,14 @@ ORDER BY pdate</CommandText>
|
||||
<xs:element name="selfTo" msprop:Generator_ColumnPropNameInTable="selfToColumn" msprop:nullValue="0" msprop:Generator_ColumnPropNameInRow="selfTo" msprop:Generator_UserColumnName="selfTo" msprop:Generator_ColumnVarNameInTable="columnselfTo" type="xs:boolean" minOccurs="0" />
|
||||
<xs:element name="selfCC" msprop:Generator_ColumnPropNameInTable="selfCCColumn" msprop:nullValue="0" msprop:Generator_ColumnPropNameInRow="selfCC" msprop:Generator_UserColumnName="selfCC" msprop:Generator_ColumnVarNameInTable="columnselfCC" type="xs:boolean" minOccurs="0" />
|
||||
<xs:element name="selfBCC" msprop:Generator_ColumnPropNameInTable="selfBCCColumn" msprop:nullValue="0" msprop:Generator_ColumnPropNameInRow="selfBCC" msprop:Generator_UserColumnName="selfBCC" msprop:Generator_ColumnVarNameInTable="columnselfBCC" type="xs:boolean" minOccurs="0" />
|
||||
<xs:element name="wuid" msprop:Generator_ColumnPropNameInRow="wuid" msprop:Generator_ColumnPropNameInTable="wuidColumn" msprop:Generator_ColumnVarNameInTable="columnwuid" msprop:Generator_UserColumnName="wuid">
|
||||
<xs:element name="wuid" msprop:Generator_UserColumnName="wuid" msprop:Generator_ColumnPropNameInTable="wuidColumn" msprop:Generator_ColumnPropNameInRow="wuid" msprop:Generator_ColumnVarNameInTable="columnwuid">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="20" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="wdate" msprop:Generator_ColumnPropNameInRow="wdate" msprop:Generator_ColumnPropNameInTable="wdateColumn" msprop:Generator_ColumnVarNameInTable="columnwdate" msprop:Generator_UserColumnName="wdate" type="xs:dateTime" />
|
||||
<xs:element name="wdate" msprop:Generator_UserColumnName="wdate" msprop:Generator_ColumnPropNameInTable="wdateColumn" msprop:Generator_ColumnPropNameInRow="wdate" msprop:Generator_ColumnVarNameInTable="columnwdate" type="xs:dateTime" />
|
||||
<xs:element name="exceptmail" msprop:Generator_ColumnPropNameInTable="exceptmailColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="exceptmail" msprop:Generator_UserColumnName="exceptmail" msprop:Generator_ColumnVarNameInTable="columnexceptmail" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
@@ -845,11 +846,11 @@ ORDER BY pdate</CommandText>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="MailData" msprop:Generator_RowClassName="MailDataRow" msprop:Generator_RowEvHandlerName="MailDataRowChangeEventHandler" msprop:Generator_RowDeletedName="MailDataRowDeleted" msprop:Generator_RowDeletingName="MailDataRowDeleting" msprop:Generator_RowEvArgName="MailDataRowChangeEvent" msprop:Generator_TablePropName="MailData" msprop:Generator_RowChangedName="MailDataRowChanged" msprop:Generator_RowChangingName="MailDataRowChanging" msprop:Generator_TableClassName="MailDataDataTable" msprop:Generator_UserTableName="MailData" msprop:Generator_TableVarName="tableMailData">
|
||||
<xs:element name="MailData" msprop:Generator_RowEvHandlerName="MailDataRowChangeEventHandler" msprop:Generator_RowDeletedName="MailDataRowDeleted" msprop:Generator_RowDeletingName="MailDataRowDeleting" msprop:Generator_RowEvArgName="MailDataRowChangeEvent" msprop:Generator_TablePropName="MailData" msprop:Generator_RowChangedName="MailDataRowChanged" msprop:Generator_UserTableName="MailData" msprop:Generator_RowChangingName="MailDataRowChanging" msprop:Generator_RowClassName="MailDataRow" msprop:Generator_TableClassName="MailDataDataTable" msprop:Generator_TableVarName="tableMailData">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnVarNameInTable="columnidx" msprop:Generator_UserColumnName="idx" type="xs:int" />
|
||||
<xs:element name="project" msprop:Generator_ColumnPropNameInRow="project" msprop:Generator_ColumnPropNameInTable="projectColumn" msprop:Generator_ColumnVarNameInTable="columnproject" msprop:Generator_UserColumnName="project" type="xs:int" minOccurs="0" />
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnVarNameInTable="columnidx" type="xs:int" />
|
||||
<xs:element name="project" msprop:Generator_UserColumnName="project" msprop:Generator_ColumnPropNameInTable="projectColumn" msprop:Generator_ColumnPropNameInRow="project" msprop:Generator_ColumnVarNameInTable="columnproject" type="xs:int" minOccurs="0" />
|
||||
<xs:element name="gcode" msprop:Generator_ColumnPropNameInTable="gcodeColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="gcode" msprop:Generator_UserColumnName="gcode" msprop:Generator_ColumnVarNameInTable="columngcode">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
@@ -921,7 +922,7 @@ ORDER BY pdate</CommandText>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="aidx" msprop:Generator_ColumnPropNameInRow="aidx" msprop:Generator_ColumnPropNameInTable="aidxColumn" msprop:Generator_ColumnVarNameInTable="columnaidx" msprop:Generator_UserColumnName="aidx" type="xs:int" minOccurs="0" />
|
||||
<xs:element name="aidx" msprop:Generator_UserColumnName="aidx" msprop:Generator_ColumnPropNameInTable="aidxColumn" msprop:Generator_ColumnPropNameInRow="aidx" msprop:Generator_ColumnVarNameInTable="columnaidx" type="xs:int" minOccurs="0" />
|
||||
<xs:element name="atime" msprop:Generator_ColumnPropNameInTable="atimeColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="atime" msprop:Generator_UserColumnName="atime" msprop:Generator_ColumnVarNameInTable="columnatime" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
@@ -929,23 +930,23 @@ ORDER BY pdate</CommandText>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="wuid" msprop:Generator_ColumnPropNameInRow="wuid" msprop:Generator_ColumnPropNameInTable="wuidColumn" msprop:Generator_ColumnVarNameInTable="columnwuid" msprop:Generator_UserColumnName="wuid">
|
||||
<xs:element name="wuid" msprop:Generator_UserColumnName="wuid" msprop:Generator_ColumnPropNameInTable="wuidColumn" msprop:Generator_ColumnPropNameInRow="wuid" msprop:Generator_ColumnVarNameInTable="columnwuid">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="20" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="wdate" msprop:Generator_ColumnPropNameInRow="wdate" msprop:Generator_ColumnPropNameInTable="wdateColumn" msprop:Generator_ColumnVarNameInTable="columnwdate" msprop:Generator_UserColumnName="wdate" type="xs:dateTime" />
|
||||
<xs:element name="wdate" msprop:Generator_UserColumnName="wdate" msprop:Generator_ColumnPropNameInTable="wdateColumn" msprop:Generator_ColumnPropNameInRow="wdate" msprop:Generator_ColumnVarNameInTable="columnwdate" type="xs:dateTime" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="MailAuto" msprop:Generator_RowClassName="MailAutoRow" msprop:Generator_RowEvHandlerName="MailAutoRowChangeEventHandler" msprop:Generator_RowDeletedName="MailAutoRowDeleted" msprop:Generator_RowDeletingName="MailAutoRowDeleting" msprop:Generator_RowEvArgName="MailAutoRowChangeEvent" msprop:Generator_TablePropName="MailAuto" msprop:Generator_RowChangedName="MailAutoRowChanged" msprop:Generator_RowChangingName="MailAutoRowChanging" msprop:Generator_TableClassName="MailAutoDataTable" msprop:Generator_UserTableName="MailAuto" msprop:Generator_TableVarName="tableMailAuto">
|
||||
<xs:element name="MailAuto" msprop:Generator_RowEvHandlerName="MailAutoRowChangeEventHandler" msprop:Generator_RowDeletedName="MailAutoRowDeleted" msprop:Generator_RowDeletingName="MailAutoRowDeleting" msprop:Generator_RowEvArgName="MailAutoRowChangeEvent" msprop:Generator_TablePropName="MailAuto" msprop:Generator_RowChangedName="MailAutoRowChanged" msprop:Generator_UserTableName="MailAuto" msprop:Generator_RowChangingName="MailAutoRowChanging" msprop:Generator_RowClassName="MailAutoRow" msprop:Generator_TableClassName="MailAutoDataTable" msprop:Generator_TableVarName="tableMailAuto">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnVarNameInTable="columnidx" msprop:Generator_UserColumnName="idx" type="xs:int" />
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnVarNameInTable="columnidx" type="xs:int" />
|
||||
<xs:element name="enable" msprop:Generator_ColumnPropNameInTable="enableColumn" msprop:nullValue="0" msprop:Generator_ColumnPropNameInRow="enable" msprop:Generator_UserColumnName="enable" msprop:Generator_ColumnVarNameInTable="columnenable" type="xs:boolean" minOccurs="0" />
|
||||
<xs:element name="fidx" msprop:Generator_ColumnPropNameInRow="fidx" msprop:Generator_ColumnPropNameInTable="fidxColumn" msprop:Generator_ColumnVarNameInTable="columnfidx" msprop:Generator_UserColumnName="fidx" type="xs:int" />
|
||||
<xs:element name="fidx" msprop:Generator_UserColumnName="fidx" msprop:Generator_ColumnPropNameInTable="fidxColumn" msprop:Generator_ColumnPropNameInRow="fidx" msprop:Generator_ColumnVarNameInTable="columnfidx" type="xs:int" />
|
||||
<xs:element name="gcode" msprop:Generator_ColumnPropNameInTable="gcodeColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="gcode" msprop:Generator_UserColumnName="gcode" msprop:Generator_ColumnVarNameInTable="columngcode">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
@@ -1016,19 +1017,19 @@ ORDER BY pdate</CommandText>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="sday" msprop:Generator_ColumnPropNameInRow="sday" msprop:Generator_ColumnPropNameInTable="sdayColumn" msprop:Generator_ColumnVarNameInTable="columnsday" msprop:Generator_UserColumnName="sday" type="xs:base64Binary" minOccurs="0" />
|
||||
<xs:element name="wuid" msprop:Generator_ColumnPropNameInRow="wuid" msprop:Generator_ColumnPropNameInTable="wuidColumn" msprop:Generator_ColumnVarNameInTable="columnwuid" msprop:Generator_UserColumnName="wuid">
|
||||
<xs:element name="sday" msprop:Generator_UserColumnName="sday" msprop:Generator_ColumnPropNameInTable="sdayColumn" msprop:Generator_ColumnPropNameInRow="sday" msprop:Generator_ColumnVarNameInTable="columnsday" type="xs:base64Binary" minOccurs="0" />
|
||||
<xs:element name="wuid" msprop:Generator_UserColumnName="wuid" msprop:Generator_ColumnPropNameInTable="wuidColumn" msprop:Generator_ColumnPropNameInRow="wuid" msprop:Generator_ColumnVarNameInTable="columnwuid">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="20" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="wdate" msprop:Generator_ColumnPropNameInRow="wdate" msprop:Generator_ColumnPropNameInTable="wdateColumn" msprop:Generator_ColumnVarNameInTable="columnwdate" msprop:Generator_UserColumnName="wdate" type="xs:dateTime" />
|
||||
<xs:element name="wdate" msprop:Generator_UserColumnName="wdate" msprop:Generator_ColumnPropNameInTable="wdateColumn" msprop:Generator_ColumnPropNameInRow="wdate" msprop:Generator_ColumnVarNameInTable="columnwdate" type="xs:dateTime" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="vMailingProjectSchedule" msprop:Generator_RowEvHandlerName="vMailingProjectScheduleRowChangeEventHandler" msprop:Generator_RowDeletedName="vMailingProjectScheduleRowDeleted" msprop:Generator_RowDeletingName="vMailingProjectScheduleRowDeleting" msprop:Generator_RowEvArgName="vMailingProjectScheduleRowChangeEvent" msprop:Generator_TablePropName="vMailingProjectSchedule" msprop:Generator_RowChangedName="vMailingProjectScheduleRowChanged" msprop:Generator_RowChangingName="vMailingProjectScheduleRowChanging" msprop:Generator_TableClassName="vMailingProjectScheduleDataTable" msprop:Generator_RowClassName="vMailingProjectScheduleRow" msprop:Generator_TableVarName="tablevMailingProjectSchedule" msprop:Generator_UserTableName="vMailingProjectSchedule">
|
||||
<xs:element name="vMailingProjectSchedule" msprop:Generator_RowClassName="vMailingProjectScheduleRow" msprop:Generator_RowEvHandlerName="vMailingProjectScheduleRowChangeEventHandler" msprop:Generator_RowDeletedName="vMailingProjectScheduleRowDeleted" msprop:Generator_RowDeletingName="vMailingProjectScheduleRowDeleting" msprop:Generator_RowEvArgName="vMailingProjectScheduleRowChangeEvent" msprop:Generator_TablePropName="vMailingProjectSchedule" msprop:Generator_RowChangedName="vMailingProjectScheduleRowChanged" msprop:Generator_UserTableName="vMailingProjectSchedule" msprop:Generator_RowChangingName="vMailingProjectScheduleRowChanging" msprop:Generator_TableClassName="vMailingProjectScheduleDataTable" msprop:Generator_TableVarName="tablevMailingProjectSchedule">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="gcode" msprop:Generator_ColumnPropNameInTable="gcodeColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="gcode" msprop:Generator_UserColumnName="gcode" msprop:Generator_ColumnVarNameInTable="columngcode">
|
||||
@@ -1045,7 +1046,7 @@ ORDER BY pdate</CommandText>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="idx" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnVarNameInTable="columnidx" msprop:Generator_UserColumnName="idx" type="xs:int" />
|
||||
<xs:element name="idx" msprop:Generator_UserColumnName="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnVarNameInTable="columnidx" type="xs:int" />
|
||||
<xs:element name="pdate" msprop:Generator_ColumnPropNameInTable="pdateColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="pdate" msprop:Generator_UserColumnName="pdate" msprop:Generator_ColumnVarNameInTable="columnpdate" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
@@ -1112,14 +1113,14 @@ ORDER BY pdate</CommandText>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="sidx" msprop:Generator_ColumnPropNameInRow="sidx" msprop:Generator_ColumnPropNameInTable="sidxColumn" msprop:Generator_ColumnVarNameInTable="columnsidx" msprop:Generator_UserColumnName="sidx" type="xs:int" />
|
||||
<xs:element name="sidx" msprop:Generator_UserColumnName="sidx" msprop:Generator_ColumnPropNameInTable="sidxColumn" msprop:Generator_ColumnPropNameInRow="sidx" msprop:Generator_ColumnVarNameInTable="columnsidx" type="xs:int" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="ProjectsIngList" msprop:Generator_RowClassName="ProjectsIngListRow" msprop:Generator_RowEvHandlerName="ProjectsIngListRowChangeEventHandler" msprop:Generator_RowDeletedName="ProjectsIngListRowDeleted" msprop:Generator_RowDeletingName="ProjectsIngListRowDeleting" msprop:Generator_RowEvArgName="ProjectsIngListRowChangeEvent" msprop:Generator_TablePropName="ProjectsIngList" msprop:Generator_RowChangedName="ProjectsIngListRowChanged" msprop:Generator_RowChangingName="ProjectsIngListRowChanging" msprop:Generator_TableClassName="ProjectsIngListDataTable" msprop:Generator_UserTableName="ProjectsIngList" msprop:Generator_TableVarName="tableProjectsIngList">
|
||||
<xs:element name="ProjectsIngList" msprop:Generator_RowEvHandlerName="ProjectsIngListRowChangeEventHandler" msprop:Generator_RowDeletedName="ProjectsIngListRowDeleted" msprop:Generator_RowDeletingName="ProjectsIngListRowDeleting" msprop:Generator_RowEvArgName="ProjectsIngListRowChangeEvent" msprop:Generator_TablePropName="ProjectsIngList" msprop:Generator_RowChangedName="ProjectsIngListRowChanged" msprop:Generator_UserTableName="ProjectsIngList" msprop:Generator_RowChangingName="ProjectsIngListRowChanging" msprop:Generator_RowClassName="ProjectsIngListRow" msprop:Generator_TableClassName="ProjectsIngListDataTable" msprop:Generator_TableVarName="tableProjectsIngList">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnVarNameInTable="columnidx" msprop:Generator_UserColumnName="idx" type="xs:int" />
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnVarNameInTable="columnidx" type="xs:int" />
|
||||
<xs:element name="status" msprop:Generator_ColumnPropNameInTable="statusColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="status" msprop:Generator_UserColumnName="status" msprop:Generator_ColumnVarNameInTable="columnstatus" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
@@ -1196,17 +1197,17 @@ ORDER BY pdate</CommandText>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="EETGW_ProjectsSchedule" msprop:Generator_RowEvHandlerName="EETGW_ProjectsScheduleRowChangeEventHandler" msprop:Generator_RowDeletedName="EETGW_ProjectsScheduleRowDeleted" msprop:Generator_RowDeletingName="EETGW_ProjectsScheduleRowDeleting" msprop:Generator_RowEvArgName="EETGW_ProjectsScheduleRowChangeEvent" msprop:Generator_TablePropName="EETGW_ProjectsSchedule" msprop:Generator_RowChangedName="EETGW_ProjectsScheduleRowChanged" msprop:Generator_RowChangingName="EETGW_ProjectsScheduleRowChanging" msprop:Generator_TableClassName="EETGW_ProjectsScheduleDataTable" msprop:Generator_RowClassName="EETGW_ProjectsScheduleRow" msprop:Generator_TableVarName="tableEETGW_ProjectsSchedule" msprop:Generator_UserTableName="EETGW_ProjectsSchedule">
|
||||
<xs:element name="EETGW_ProjectsSchedule" msprop:Generator_RowClassName="EETGW_ProjectsScheduleRow" msprop:Generator_RowEvHandlerName="EETGW_ProjectsScheduleRowChangeEventHandler" msprop:Generator_RowDeletedName="EETGW_ProjectsScheduleRowDeleted" msprop:Generator_RowDeletingName="EETGW_ProjectsScheduleRowDeleting" msprop:Generator_RowEvArgName="EETGW_ProjectsScheduleRowChangeEvent" msprop:Generator_TablePropName="EETGW_ProjectsSchedule" msprop:Generator_RowChangedName="EETGW_ProjectsScheduleRowChanged" msprop:Generator_UserTableName="EETGW_ProjectsSchedule" msprop:Generator_RowChangingName="EETGW_ProjectsScheduleRowChanging" msprop:Generator_TableClassName="EETGW_ProjectsScheduleDataTable" msprop:Generator_TableVarName="tableEETGW_ProjectsSchedule">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnVarNameInTable="columnidx" msprop:Generator_UserColumnName="idx" type="xs:int" />
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnVarNameInTable="columnidx" type="xs:int" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="vJobReportForUser" msprop:Generator_RowClassName="vJobReportForUserRow" msprop:Generator_RowEvHandlerName="vJobReportForUserRowChangeEventHandler" msprop:Generator_RowDeletedName="vJobReportForUserRowDeleted" msprop:Generator_RowDeletingName="vJobReportForUserRowDeleting" msprop:Generator_RowEvArgName="vJobReportForUserRowChangeEvent" msprop:Generator_TablePropName="vJobReportForUser" msprop:Generator_RowChangedName="vJobReportForUserRowChanged" msprop:Generator_RowChangingName="vJobReportForUserRowChanging" msprop:Generator_TableClassName="vJobReportForUserDataTable" msprop:Generator_UserTableName="vJobReportForUser" msprop:Generator_TableVarName="tablevJobReportForUser">
|
||||
<xs:element name="vJobReportForUser" msprop:Generator_RowEvHandlerName="vJobReportForUserRowChangeEventHandler" msprop:Generator_RowDeletedName="vJobReportForUserRowDeleted" msprop:Generator_RowDeletingName="vJobReportForUserRowDeleting" msprop:Generator_RowEvArgName="vJobReportForUserRowChangeEvent" msprop:Generator_TablePropName="vJobReportForUser" msprop:Generator_RowChangedName="vJobReportForUserRowChanged" msprop:Generator_UserTableName="vJobReportForUser" msprop:Generator_RowChangingName="vJobReportForUserRowChanging" msprop:Generator_RowClassName="vJobReportForUserRow" msprop:Generator_TableClassName="vJobReportForUserDataTable" msprop:Generator_TableVarName="tablevJobReportForUser">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="id" msprop:Generator_ColumnPropNameInRow="id" msprop:Generator_ColumnPropNameInTable="idColumn" msprop:Generator_ColumnVarNameInTable="columnid" msprop:Generator_UserColumnName="id" minOccurs="0">
|
||||
<xs:element name="id" msprop:Generator_UserColumnName="id" msprop:Generator_ColumnPropNameInTable="idColumn" msprop:Generator_ColumnPropNameInRow="id" msprop:Generator_ColumnVarNameInTable="columnid" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="20" />
|
||||
@@ -1223,10 +1224,10 @@ ORDER BY pdate</CommandText>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="JobReport" msprop:Generator_RowClassName="JobReportRow" msprop:Generator_RowEvHandlerName="JobReportRowChangeEventHandler" msprop:Generator_RowDeletedName="JobReportRowDeleted" msprop:Generator_RowDeletingName="JobReportRowDeleting" msprop:Generator_RowEvArgName="JobReportRowChangeEvent" msprop:Generator_TablePropName="JobReport" msprop:Generator_RowChangedName="JobReportRowChanged" msprop:Generator_RowChangingName="JobReportRowChanging" msprop:Generator_TableClassName="JobReportDataTable" msprop:Generator_UserTableName="JobReport" msprop:Generator_TableVarName="tableJobReport">
|
||||
<xs:element name="JobReport" msprop:Generator_RowEvHandlerName="JobReportRowChangeEventHandler" msprop:Generator_RowDeletedName="JobReportRowDeleted" msprop:Generator_RowDeletingName="JobReportRowDeleting" msprop:Generator_RowEvArgName="JobReportRowChangeEvent" msprop:Generator_TablePropName="JobReport" msprop:Generator_RowChangedName="JobReportRowChanged" msprop:Generator_UserTableName="JobReport" msprop:Generator_RowChangingName="JobReportRowChanging" msprop:Generator_RowClassName="JobReportRow" msprop:Generator_TableClassName="JobReportDataTable" msprop:Generator_TableVarName="tableJobReport">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnVarNameInTable="columnidx" msprop:Generator_UserColumnName="idx" type="xs:int" />
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnVarNameInTable="columnidx" type="xs:int" />
|
||||
<xs:element name="gcode" msprop:Generator_ColumnPropNameInTable="gcodeColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="gcode" msprop:Generator_UserColumnName="gcode" msprop:Generator_ColumnVarNameInTable="columngcode">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
@@ -1241,7 +1242,7 @@ ORDER BY pdate</CommandText>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="pidx" msprop:Generator_ColumnPropNameInRow="pidx" msprop:Generator_ColumnPropNameInTable="pidxColumn" msprop:Generator_ColumnVarNameInTable="columnpidx" msprop:Generator_UserColumnName="pidx" type="xs:int" minOccurs="0" />
|
||||
<xs:element name="pidx" msprop:Generator_UserColumnName="pidx" msprop:Generator_ColumnPropNameInTable="pidxColumn" msprop:Generator_ColumnPropNameInRow="pidx" msprop:Generator_ColumnVarNameInTable="columnpidx" type="xs:int" minOccurs="0" />
|
||||
<xs:element name="projectName" msprop:Generator_ColumnPropNameInTable="projectNameColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="projectName" msprop:Generator_UserColumnName="projectName" msprop:Generator_ColumnVarNameInTable="columnprojectName" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
@@ -1293,8 +1294,8 @@ ORDER BY pdate</CommandText>
|
||||
</xs:element>
|
||||
<xs:element name="hrs" msprop:Generator_ColumnPropNameInTable="hrsColumn" msprop:nullValue="0" msprop:Generator_ColumnPropNameInRow="hrs" msprop:Generator_UserColumnName="hrs" msprop:Generator_ColumnVarNameInTable="columnhrs" type="xs:double" minOccurs="0" />
|
||||
<xs:element name="ot" msprop:Generator_ColumnPropNameInTable="otColumn" msprop:nullValue="0" msprop:Generator_ColumnPropNameInRow="ot" msprop:Generator_UserColumnName="ot" msprop:Generator_ColumnVarNameInTable="columnot" type="xs:double" minOccurs="0" />
|
||||
<xs:element name="otStart" msprop:Generator_ColumnPropNameInRow="otStart" msprop:Generator_ColumnPropNameInTable="otStartColumn" msprop:Generator_ColumnVarNameInTable="columnotStart" msprop:Generator_UserColumnName="otStart" type="xs:dateTime" minOccurs="0" />
|
||||
<xs:element name="otEnd" msprop:Generator_ColumnPropNameInRow="otEnd" msprop:Generator_ColumnPropNameInTable="otEndColumn" msprop:Generator_ColumnVarNameInTable="columnotEnd" msprop:Generator_UserColumnName="otEnd" type="xs:dateTime" minOccurs="0" />
|
||||
<xs:element name="otStart" msprop:Generator_UserColumnName="otStart" msprop:Generator_ColumnPropNameInTable="otStartColumn" msprop:Generator_ColumnPropNameInRow="otStart" msprop:Generator_ColumnVarNameInTable="columnotStart" type="xs:dateTime" minOccurs="0" />
|
||||
<xs:element name="otEnd" msprop:Generator_UserColumnName="otEnd" msprop:Generator_ColumnPropNameInTable="otEndColumn" msprop:Generator_ColumnPropNameInRow="otEnd" msprop:Generator_ColumnVarNameInTable="columnotEnd" type="xs:dateTime" minOccurs="0" />
|
||||
<xs:element name="import" msprop:Generator_ColumnPropNameInTable="importColumn" msprop:nullValue="0" msprop:Generator_ColumnPropNameInRow="import" msprop:Generator_UserColumnName="import" msprop:Generator_ColumnVarNameInTable="columnimport" type="xs:boolean" minOccurs="0" />
|
||||
<xs:element name="wuid" msprop:Generator_ColumnPropNameInTable="wuidColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="wuid" msprop:Generator_UserColumnName="wuid" msprop:Generator_ColumnVarNameInTable="columnwuid">
|
||||
<xs:simpleType>
|
||||
@@ -1303,7 +1304,7 @@ ORDER BY pdate</CommandText>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="wdate" msprop:Generator_ColumnPropNameInRow="wdate" msprop:Generator_ColumnPropNameInTable="wdateColumn" msprop:Generator_ColumnVarNameInTable="columnwdate" msprop:Generator_UserColumnName="wdate" type="xs:dateTime" />
|
||||
<xs:element name="wdate" msprop:Generator_UserColumnName="wdate" msprop:Generator_ColumnPropNameInTable="wdateColumn" msprop:Generator_ColumnPropNameInRow="wdate" msprop:Generator_ColumnVarNameInTable="columnwdate" type="xs:dateTime" />
|
||||
<xs:element name="tag" msprop:Generator_ColumnPropNameInTable="tagColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="tag" msprop:Generator_UserColumnName="tag" msprop:Generator_ColumnVarNameInTable="columntag" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
@@ -1342,14 +1343,14 @@ ORDER BY pdate</CommandText>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="ottime" msprop:Generator_ColumnPropNameInRow="ottime" msprop:Generator_ColumnPropNameInTable="ottimeColumn" msprop:Generator_ColumnVarNameInTable="columnottime" msprop:Generator_UserColumnName="ottime" type="xs:dateTime" minOccurs="0" />
|
||||
<xs:element name="ottime" msprop:Generator_UserColumnName="ottime" msprop:Generator_ColumnPropNameInTable="ottimeColumn" msprop:Generator_ColumnPropNameInRow="ottime" msprop:Generator_ColumnVarNameInTable="columnottime" type="xs:dateTime" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="HolidayLIst" msprop:Generator_RowEvHandlerName="HolidayLIstRowChangeEventHandler" msprop:Generator_RowDeletedName="HolidayLIstRowDeleted" msprop:Generator_RowDeletingName="HolidayLIstRowDeleting" msprop:Generator_RowEvArgName="HolidayLIstRowChangeEvent" msprop:Generator_TablePropName="HolidayLIst" msprop:Generator_RowChangedName="HolidayLIstRowChanged" msprop:Generator_RowChangingName="HolidayLIstRowChanging" msprop:Generator_TableClassName="HolidayLIstDataTable" msprop:Generator_RowClassName="HolidayLIstRow" msprop:Generator_TableVarName="tableHolidayLIst" msprop:Generator_UserTableName="HolidayLIst">
|
||||
<xs:element name="HolidayLIst" msprop:Generator_RowClassName="HolidayLIstRow" msprop:Generator_RowEvHandlerName="HolidayLIstRowChangeEventHandler" msprop:Generator_RowDeletedName="HolidayLIstRowDeleted" msprop:Generator_RowDeletingName="HolidayLIstRowDeleting" msprop:Generator_RowEvArgName="HolidayLIstRowChangeEvent" msprop:Generator_TablePropName="HolidayLIst" msprop:Generator_RowChangedName="HolidayLIstRowChanged" msprop:Generator_UserTableName="HolidayLIst" msprop:Generator_RowChangingName="HolidayLIstRowChanging" msprop:Generator_TableClassName="HolidayLIstDataTable" msprop:Generator_TableVarName="tableHolidayLIst">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnVarNameInTable="columnidx" msprop:Generator_UserColumnName="idx" type="xs:int" />
|
||||
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnVarNameInTable="columnidx" type="xs:int" />
|
||||
<xs:element name="pdate" msprop:Generator_ColumnPropNameInTable="pdateColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="pdate" msprop:Generator_UserColumnName="pdate" msprop:Generator_ColumnVarNameInTable="columnpdate" minOccurs="0">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
@@ -1365,18 +1366,18 @@ ORDER BY pdate</CommandText>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="wuid" msprop:Generator_ColumnPropNameInRow="wuid" msprop:Generator_ColumnPropNameInTable="wuidColumn" msprop:Generator_ColumnVarNameInTable="columnwuid" msprop:Generator_UserColumnName="wuid">
|
||||
<xs:element name="wuid" msprop:Generator_UserColumnName="wuid" msprop:Generator_ColumnPropNameInTable="wuidColumn" msprop:Generator_ColumnPropNameInRow="wuid" msprop:Generator_ColumnVarNameInTable="columnwuid">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="20" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="wdate" msprop:Generator_ColumnPropNameInRow="wdate" msprop:Generator_ColumnPropNameInTable="wdateColumn" msprop:Generator_ColumnVarNameInTable="columnwdate" msprop:Generator_UserColumnName="wdate" type="xs:dateTime" />
|
||||
<xs:element name="wdate" msprop:Generator_UserColumnName="wdate" msprop:Generator_ColumnPropNameInTable="wdateColumn" msprop:Generator_ColumnPropNameInRow="wdate" msprop:Generator_ColumnVarNameInTable="columnwdate" type="xs:dateTime" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="vGroupUser" msprop:Generator_RowClassName="vGroupUserRow" msprop:Generator_RowEvHandlerName="vGroupUserRowChangeEventHandler" msprop:Generator_RowDeletedName="vGroupUserRowDeleted" msprop:Generator_RowDeletingName="vGroupUserRowDeleting" msprop:Generator_RowEvArgName="vGroupUserRowChangeEvent" msprop:Generator_TablePropName="vGroupUser" msprop:Generator_RowChangedName="vGroupUserRowChanged" msprop:Generator_RowChangingName="vGroupUserRowChanging" msprop:Generator_TableClassName="vGroupUserDataTable" msprop:Generator_UserTableName="vGroupUser" msprop:Generator_TableVarName="tablevGroupUser">
|
||||
<xs:element name="vGroupUser" msprop:Generator_RowEvHandlerName="vGroupUserRowChangeEventHandler" msprop:Generator_RowDeletedName="vGroupUserRowDeleted" msprop:Generator_RowDeletingName="vGroupUserRowDeleting" msprop:Generator_RowEvArgName="vGroupUserRowChangeEvent" msprop:Generator_TablePropName="vGroupUser" msprop:Generator_RowChangedName="vGroupUserRowChanged" msprop:Generator_UserTableName="vGroupUser" msprop:Generator_RowChangingName="vGroupUserRowChanging" msprop:Generator_RowClassName="vGroupUserRow" msprop:Generator_TableClassName="vGroupUserDataTable" msprop:Generator_TableVarName="tablevGroupUser">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="gcode" msprop:Generator_ColumnPropNameInTable="gcodeColumn" msprop:nullValue="_empty" msprop:Generator_ColumnPropNameInRow="gcode" msprop:Generator_UserColumnName="gcode" msprop:Generator_ColumnVarNameInTable="columngcode">
|
||||
@@ -1518,10 +1519,10 @@ ORDER BY pdate</CommandText>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="JobReportDateList" msprop:Generator_RowEvHandlerName="JobReportDateListRowChangeEventHandler" msprop:Generator_RowDeletedName="JobReportDateListRowDeleted" msprop:Generator_RowDeletingName="JobReportDateListRowDeleting" msprop:Generator_RowEvArgName="JobReportDateListRowChangeEvent" msprop:Generator_TablePropName="JobReportDateList" msprop:Generator_RowChangedName="JobReportDateListRowChanged" msprop:Generator_RowChangingName="JobReportDateListRowChanging" msprop:Generator_TableClassName="JobReportDateListDataTable" msprop:Generator_RowClassName="JobReportDateListRow" msprop:Generator_TableVarName="tableJobReportDateList" msprop:Generator_UserTableName="JobReportDateList">
|
||||
<xs:element name="JobReportDateList" msprop:Generator_RowClassName="JobReportDateListRow" msprop:Generator_RowEvHandlerName="JobReportDateListRowChangeEventHandler" msprop:Generator_RowDeletedName="JobReportDateListRowDeleted" msprop:Generator_RowDeletingName="JobReportDateListRowDeleting" msprop:Generator_RowEvArgName="JobReportDateListRowChangeEvent" msprop:Generator_TablePropName="JobReportDateList" msprop:Generator_RowChangedName="JobReportDateListRowChanged" msprop:Generator_UserTableName="JobReportDateList" msprop:Generator_RowChangingName="JobReportDateListRowChanging" msprop:Generator_TableClassName="JobReportDateListDataTable" msprop:Generator_TableVarName="tableJobReportDateList">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="pdate" msprop:Generator_ColumnPropNameInRow="pdate" msprop:Generator_ColumnPropNameInTable="pdateColumn" msprop:Generator_ColumnVarNameInTable="columnpdate" msprop:Generator_UserColumnName="pdate" minOccurs="0">
|
||||
<xs:element name="pdate" msprop:Generator_UserColumnName="pdate" msprop:Generator_ColumnPropNameInTable="pdateColumn" msprop:Generator_ColumnPropNameInRow="pdate" msprop:Generator_ColumnVarNameInTable="columnpdate">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="10" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="16" ViewPortY="-10" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<DiagramLayout xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="-10" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<Shapes>
|
||||
<Shape ID="DesignTable:MailForm" ZOrder="11" X="222" Y="158" Height="305" Width="200" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:MailData" ZOrder="10" X="456" Y="157" Height="305" Width="197" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
@@ -12,8 +12,8 @@
|
||||
<Shape ID="DesignTable:vMailingProjectSchedule" ZOrder="8" X="204" Y="490" Height="305" Width="289" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:ProjectsIngList" ZOrder="7" X="514" Y="488" Height="305" Width="191" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="237" />
|
||||
<Shape ID="DesignTable:EETGW_ProjectsSchedule" ZOrder="6" X="769" Y="496" Height="96" Width="291" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="46" />
|
||||
<Shape ID="DesignTable:vJobReportForUser" ZOrder="3" X="1206" Y="86" Height="229" Width="257" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="121" />
|
||||
<Shape ID="DesignTable:JobReport" ZOrder="1" X="927" Y="84" Height="400" Width="318" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="332" />
|
||||
<Shape ID="DesignTable:vJobReportForUser" ZOrder="1" X="1206" Y="86" Height="229" Width="257" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="121" />
|
||||
<Shape ID="DesignTable:JobReport" ZOrder="3" X="927" Y="84" Height="400" Width="318" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="332" />
|
||||
<Shape ID="DesignTable:HolidayLIst" ZOrder="5" X="823" Y="620" Height="191" Width="210" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="140" />
|
||||
<Shape ID="DesignTable:vGroupUser" ZOrder="2" X="1159" Y="468" Height="324" Width="230" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:JobReportDateList" ZOrder="4" X="359" Y="85" Height="96" Width="212" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="46" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</autogenerated>-->
|
||||
<DiagramLayout xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ex:showrelationlabel="False" ViewPortX="188" ViewPortY="0" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<Shapes>
|
||||
<Shape ID="DesignSources:QueriesTableAdapter" ZOrder="1" X="198" Y="288" Height="48" Width="273" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="44" />
|
||||
<Shape ID="DesignSources:QueriesTableAdapter" ZOrder="1" X="198" Y="286" Height="49" Width="400" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="45" />
|
||||
</Shapes>
|
||||
<Connectors />
|
||||
</DiagramLayout>
|
||||
@@ -26,7 +26,7 @@ namespace Project.Dialog
|
||||
};
|
||||
this.Text = string.Format("사용자 확인(v{0})", Application.ProductVersion);
|
||||
|
||||
var lv = this.listView1.Items.Add("[25-04-06] 데이터베이스가 이전 작업 완료");
|
||||
var lv = this.listView1.Items.Add("[25-04-06] 데이터베이스 이전 작업 완료 (버그신고:chikyun.kim@amkor.co.kr)");
|
||||
lv.Tag = "기존 데이터베이스 삭제 예정으로 인한 신규 데이터베이스 업데이트 작업 완료\n일부 기능에 문제가 발생할 수 있습니다. 문제 발생시에는 chikyun.kim@amkor.co.kr 로 문의 주세요";
|
||||
}
|
||||
private void fLogin_Load(object sender, EventArgs e)
|
||||
@@ -53,7 +53,9 @@ namespace Project.Dialog
|
||||
|
||||
|
||||
//그룹목록가져오기
|
||||
//Util.MsgE(Properties.Settings.Default.CS);
|
||||
var tagrp = new dsMSSQLTableAdapters.UserGroupTableAdapter();
|
||||
//Util.MsgE(tagrp.Connection.ConnectionString);
|
||||
var grplist = tagrp.GetData();
|
||||
this.cmbDept.DataSource = grplist;
|
||||
this.cmbDept.DisplayMember = "dept";
|
||||
@@ -139,14 +141,14 @@ namespace Project.Dialog
|
||||
{
|
||||
var taGrpUser = new dsMSSQLTableAdapters.EETGW_GroupUserTableAdapter();
|
||||
var drGrpUser = taGrpUser.GetbyID(gCode, id).FirstOrDefault();
|
||||
if(drGrpUser == null)
|
||||
if (drGrpUser == null)
|
||||
{
|
||||
Util.MsgE($"입력한 사용자 계정이 존재하지 않습니다\n\n담당부서명:{cmbDept.Text}\n부서코드:{gCode}\n\n접속 부서를 확인하시고 관리자 문의 하세요");
|
||||
tbPW.SelectAll();
|
||||
tbPW.Focus();
|
||||
return;
|
||||
}
|
||||
else if(drGrpUser.level == 0)
|
||||
else if (drGrpUser.level == 0)
|
||||
{
|
||||
Util.MsgE($"해당 계정이 활성화되지 않았습니다\n계정 담당자 문의하세요");
|
||||
tbPW.SelectAll();
|
||||
@@ -157,14 +159,14 @@ namespace Project.Dialog
|
||||
//사용자테이블에서 암호를 확인합니다.
|
||||
var taUser = new dsMSSQLTableAdapters.UsersTableAdapter();
|
||||
var drUser = taUser.GetID(id).FirstOrDefault();
|
||||
if(drUser == null)
|
||||
if (drUser == null)
|
||||
{
|
||||
Util.MsgE($"입력한 사용자 계정이 존재하지 않습니다\n\n담당부서명:{cmbDept.Text}\n부서코드:{gCode}\n\n접속 부서를 확인하시고 관리자 문의 하세요");
|
||||
tbPW.SelectAll();
|
||||
tbPW.Focus();
|
||||
return;
|
||||
}
|
||||
else if(drUser.password.Equals(encpass)==false)
|
||||
else if (drUser.password.Equals(encpass) == false)
|
||||
{
|
||||
Util.MsgE($"암호가 일치하지 않습니다.\n암호를 분실했을 경우에는 계정담당자에 초기화를 요청 하세요");
|
||||
tbPW.SelectAll();
|
||||
@@ -272,34 +274,37 @@ namespace Project.Dialog
|
||||
{
|
||||
//누군가가 로그인하면 당일 자동 생성되어야할 유저의 데이터를 기록한다.
|
||||
|
||||
var dbi = new EEEntitiesMain();
|
||||
var db = new EEEntitiesMain();
|
||||
var dbAI = new dsMSSQLTableAdapters.EETGW_JobReport_AutoInputTableAdapter();// EEEntitiesMain();
|
||||
var dbGU = new dsMSSQLTableAdapters.vGroupUserTableAdapter();// EEEntitiesMain();
|
||||
var dbHL = new dsMSSQLTableAdapters.HolidayLIstTableAdapter();
|
||||
var dbJR = new dsMSSQLTableAdapters.JobReportTableAdapter();
|
||||
var taQuery = new DSQueryTableAdapters.QueriesTableAdapter();
|
||||
|
||||
var nd = DateTime.Now.ToShortDateString();
|
||||
|
||||
//이 날짜가 휴일인지 체크한다.
|
||||
var Holyinfo = db.HolidayLIst.Where(t => t.pdate == nd).FirstOrDefault();
|
||||
if (Holyinfo != null && Holyinfo.free != null && (bool)(Holyinfo.free)) return;
|
||||
var Holyinfo = dbHL.GetData(nd).FirstOrDefault();// db.HolidayLIst.Where(t => t.pdate == nd).FirstOrDefault();
|
||||
if (Holyinfo != null && Holyinfo.IsfreeNull() == false && Holyinfo.free == true) return;
|
||||
|
||||
|
||||
//토,일은 처리하지 않음
|
||||
if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday || DateTime.Now.DayOfWeek == DayOfWeek.Sunday) return;
|
||||
|
||||
// db.EETGW_JobReport_AutoInput.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.enable == true && t.autoinput == "A" && t.pdate.CompareTo(nd) <= 0 && (string.IsNullOrEmpty(t.edate) == true || t.edate.CompareTo(nd) > 0));
|
||||
var rows = dbAI.GetActiveList(info.Login.gcode, "A", "%", nd);
|
||||
|
||||
var rows = db.EETGW_JobReport_AutoInput.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.enable == true && t.autoinput == "A" && t.pdate.CompareTo(nd) <= 0 && (string.IsNullOrEmpty(t.edate) == true || t.edate.CompareTo(nd) > 0));
|
||||
foreach (var dr in rows)
|
||||
{
|
||||
//퇴사자 확인
|
||||
var userdata = db.vGroupUser.Where(t => t.id == dr.uid).FirstOrDefault();
|
||||
if (userdata != null && string.IsNullOrEmpty(userdata.outdate) == false) continue;
|
||||
|
||||
|
||||
|
||||
var userdata = dbGU.GetByID(FCOMMON.info.Login.gcode, dr.uid).FirstOrDefault();// db.vGroupUser.Where(t => t.id == dr.uid).FirstOrDefault();
|
||||
if (userdata != null && userdata.IsoutdateNull() == false) continue;
|
||||
|
||||
//오늘자 자동생성된 데이터가 있다면 처리하지 않는다
|
||||
if (db.JobReport.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate == nd && t.uid == dr.uid && t.autoinput == true).Any()) continue;
|
||||
if (taQuery.ExistAutoInputData(info.Login.gcode, dr.uid, nd) > 0) continue; //db.JobReport.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate == nd && t.uid == dr.uid && t.autoinput == true).Any())
|
||||
|
||||
//이데이터를 그대로 생성해준다.
|
||||
var newdr = new JobReport();
|
||||
var dtjr = new dsMSSQL.JobReportDataTable();
|
||||
var newdr = dtjr.NewJobReportRow();
|
||||
newdr.gcode = FCOMMON.info.Login.gcode;
|
||||
newdr.wuid = dr.uid;// FCOMMON.info.Login.no;
|
||||
newdr.wdate = DateTime.Now;
|
||||
@@ -320,12 +325,14 @@ namespace Project.Dialog
|
||||
newdr.status = dr.status;
|
||||
newdr.tag = dr.tag;
|
||||
newdr.uid = dr.uid;
|
||||
dbi.JobReport.Add(newdr);
|
||||
dbi.SaveChanges();
|
||||
dtjr.AddJobReportRow(newdr);
|
||||
dbJR.Update(dtjr);
|
||||
}
|
||||
dbi.Dispose();
|
||||
db.Dispose();
|
||||
|
||||
dbAI.Dispose();
|
||||
dbGU.Dispose();
|
||||
dbHL.Dispose();
|
||||
dbJR.Dispose();
|
||||
taQuery.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -339,12 +346,12 @@ namespace Project.Dialog
|
||||
|
||||
var taQ = new DSQueryTableAdapters.QueriesTableAdapter();
|
||||
var exist = taQ.ExistAutoInputData(info.Login.gcode, info.Login.no, nd) > 0;
|
||||
var db = new EEEntitiesMain();
|
||||
|
||||
//var db = new EEEntitiesMain();
|
||||
|
||||
if (exist == false)
|
||||
{
|
||||
var taM = new dsMSSQLTableAdapters.EETGW_JobReport_AutoInputTableAdapter();
|
||||
var rows = taM.GetActiveList(info.Login.gcode, info.Login.no, nd);
|
||||
var rows = taM.GetActiveList(info.Login.gcode, "L", info.Login.no, nd);
|
||||
|
||||
//var rows = db.EETGW_JobReport_AutoInput.Where(t => t.gcode == FCOMMON.info.Login.gcode &&
|
||||
//t.enable == true &&
|
||||
@@ -468,7 +475,7 @@ namespace Project.Dialog
|
||||
if (dlg != DialogResult.Yes) return;
|
||||
var f = new _Common.fAddNewUser(cmbDept.Text, string.Empty, 0);//.fUserInfo();
|
||||
dlg = f.ShowDialog();
|
||||
if(dlg == DialogResult.OK)
|
||||
if (dlg == DialogResult.OK)
|
||||
{
|
||||
tbID.Text = f.tbId.Text.Trim();
|
||||
}
|
||||
@@ -480,8 +487,8 @@ namespace Project.Dialog
|
||||
if (lv == null) return;
|
||||
if (lv.Tag == null) return;
|
||||
var msg = lv.Tag.ToString();
|
||||
Util.MsgI(msg);
|
||||
|
||||
Util.MsgI(msg);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,9 @@
|
||||
<Reference Include="CsvHelper, Version=30.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CsvHelper.30.0.1\lib\net45\CsvHelper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DatabaseConnectionString">
|
||||
<HintPath>..\DLL\DatabaseConnectionString.exe</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>
|
||||
@@ -245,21 +248,6 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdoNetEFMain.Context.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<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="BaseController.cs" />
|
||||
<Compile Include="Controller\APIController.cs" />
|
||||
<Compile Include="Controller\ManualController.cs" />
|
||||
@@ -273,9 +261,6 @@
|
||||
<Compile Include="Controller\ResultController.cs" />
|
||||
<Compile Include="Controller\SettingController.cs" />
|
||||
<Compile Include="CResult.cs" />
|
||||
<Compile Include="Customs.cs">
|
||||
<DependentUpon>ModelCommon.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DataSet1.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
@@ -349,29 +334,16 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>dsMSSQL.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="dsProjects.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>dsProjects.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DSQuery.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>DSQuery.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="EETGW_GroupUser.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="EETGW_JobReport_AutoInput.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="EETGW_LoginInfo.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="EETGW_ProjecthistoryD.cs">
|
||||
<DependentUpon>ModelProject.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="EETGW_ProjectsSchedule.cs">
|
||||
<DependentUpon>ModelProject.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="EETGW_ProjectToDo.cs">
|
||||
<DependentUpon>ModelProject.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="fLog.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -390,127 +362,22 @@
|
||||
<Compile Include="fSetting.Designer.cs">
|
||||
<DependentUpon>fSetting.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="HolidayLIst.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Items.cs">
|
||||
<DependentUpon>ModelPurchase.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="JobReport.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Language\Lang.cs" />
|
||||
<Compile Include="Manager\DataBaseManager.cs" />
|
||||
<Compile Include="Manager\keyValuedataTable.cs" />
|
||||
<Compile Include="Manager\ModelManager.cs" />
|
||||
<Compile Include="MessageWindow.cs" />
|
||||
<Compile Include="MethodExtentions.cs" />
|
||||
<Compile Include="ModelCommon.Context.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ModelCommon.Context.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ModelCommon.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ModelCommon.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ModelCommon.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ModelCommon.edmx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ModelJobreport.Context.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ModelJobreport.Context.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ModelJobreport.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ModelJobreport.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ModelJobreport.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ModelJobreport.edmx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ModelProject.Context.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ModelProject.Context.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ModelProject.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ModelProject.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ModelProject.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ModelProject.edmx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ModelPurchase.Context.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ModelPurchase.Context.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ModelPurchase.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ModelPurchase.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ModelPurchase.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ModelPurchase.edmx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\PageModel.cs" />
|
||||
<Compile Include="OWIN\Startup.cs" />
|
||||
<Compile Include="OWIN\StartupSSE.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Projects.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ProjectsHistory.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ProjectsIOMap.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ProjectsMailList.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ProjectsPart.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Purchase.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Settings.cs" />
|
||||
<Compile Include="SqlServerTypes\Loader.cs" />
|
||||
<Compile Include="StateMachine\ReportUserData.cs" />
|
||||
<Compile Include="StateMachine\_MailService.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UserGroup.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Users.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="vFindSID.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="vGroupUser.cs">
|
||||
<DependentUpon>AdoNetEFMain.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="vJobReportForUser.cs">
|
||||
<DependentUpon>ModelJobreport.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="vPurchase.cs">
|
||||
<DependentUpon>ModelPurchase.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="_Common\fADSUserList.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -640,13 +507,6 @@
|
||||
<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="DataSet1.xsc">
|
||||
<DependentUpon>DataSet1.xsd</DependentUpon>
|
||||
@@ -681,6 +541,17 @@
|
||||
<None Include="dsMSSQL.xss">
|
||||
<DependentUpon>dsMSSQL.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="dsProjects.xsc">
|
||||
<DependentUpon>dsProjects.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="dsProjects.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSDataSetGenerator</Generator>
|
||||
<LastGenOutput>dsProjects.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="dsProjects.xss">
|
||||
<DependentUpon>dsProjects.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="DSQuery.xsc">
|
||||
<DependentUpon>DSQuery.xsd</DependentUpon>
|
||||
</None>
|
||||
@@ -695,34 +566,6 @@
|
||||
<None Include="Manual.pdf">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<EntityDeploy Include="ModelPurchase.edmx">
|
||||
<Generator>EntityModelCodeGenerator</Generator>
|
||||
<LastGenOutput>ModelPurchase.Designer.cs</LastGenOutput>
|
||||
</EntityDeploy>
|
||||
<EntityDeploy Include="ModelCommon.edmx">
|
||||
<Generator>EntityModelCodeGenerator</Generator>
|
||||
<LastGenOutput>ModelCommon.Designer.cs</LastGenOutput>
|
||||
</EntityDeploy>
|
||||
<None Include="ModelCommon.edmx.diagram">
|
||||
<DependentUpon>ModelCommon.edmx</DependentUpon>
|
||||
</None>
|
||||
<EntityDeploy Include="ModelJobreport.edmx">
|
||||
<Generator>EntityModelCodeGenerator</Generator>
|
||||
<LastGenOutput>ModelJobreport.Designer.cs</LastGenOutput>
|
||||
</EntityDeploy>
|
||||
<None Include="ModelJobreport.edmx.diagram">
|
||||
<DependentUpon>ModelJobreport.edmx</DependentUpon>
|
||||
</None>
|
||||
<EntityDeploy Include="ModelProject.edmx">
|
||||
<Generator>EntityModelCodeGenerator</Generator>
|
||||
<LastGenOutput>ModelProject.Designer.cs</LastGenOutput>
|
||||
</EntityDeploy>
|
||||
<None Include="ModelProject.edmx.diagram">
|
||||
<DependentUpon>ModelProject.edmx</DependentUpon>
|
||||
</None>
|
||||
<None Include="ModelPurchase.edmx.diagram">
|
||||
<DependentUpon>ModelPurchase.edmx</DependentUpon>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\app.manifest" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
@@ -742,61 +585,11 @@
|
||||
</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">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="ModelCommon.Context.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<DependentUpon>ModelCommon.edmx</DependentUpon>
|
||||
<LastGenOutput>ModelCommon.Context.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Content Include="ModelCommon.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<DependentUpon>ModelCommon.edmx</DependentUpon>
|
||||
<LastGenOutput>ModelCommon.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Content Include="ModelJobreport.Context.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<DependentUpon>ModelJobreport.edmx</DependentUpon>
|
||||
<LastGenOutput>ModelJobreport.Context.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Content Include="ModelJobreport.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<DependentUpon>ModelJobreport.edmx</DependentUpon>
|
||||
<LastGenOutput>ModelJobreport.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Content Include="ModelProject.Context.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<DependentUpon>ModelProject.edmx</DependentUpon>
|
||||
<LastGenOutput>ModelProject.Context.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Content Include="ModelProject.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<DependentUpon>ModelProject.edmx</DependentUpon>
|
||||
<LastGenOutput>ModelProject.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Content Include="ModelPurchase.Context.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<DependentUpon>ModelPurchase.edmx</DependentUpon>
|
||||
<LastGenOutput>ModelPurchase.Context.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Content Include="ModelPurchase.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<DependentUpon>ModelPurchase.edmx</DependentUpon>
|
||||
<LastGenOutput>ModelPurchase.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Content Include="SqlServerTypes\readme.htm" />
|
||||
<Content Include="SqlServerTypes\x64\msvcr120.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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 state { get; set; }
|
||||
public Nullable<bool> useJobReport { get; set; }
|
||||
public Nullable<bool> useUserState { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
public Nullable<bool> exceptHoly { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class EETGW_JobReport_AutoInput
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public string gcode { get; set; }
|
||||
public string pdate { get; set; }
|
||||
public string edate { get; set; }
|
||||
public Nullable<int> pidx { get; set; }
|
||||
public string projectName { get; set; }
|
||||
public string uid { get; set; }
|
||||
public string requestpart { get; set; }
|
||||
public string package { get; set; }
|
||||
public string status { get; set; }
|
||||
public string type { get; set; }
|
||||
public string process { get; set; }
|
||||
public string description { get; set; }
|
||||
public string remark { get; set; }
|
||||
public Nullable<double> hrs { get; set; }
|
||||
public Nullable<double> ot { get; set; }
|
||||
public Nullable<bool> import { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
public string description2 { get; set; }
|
||||
public string tag { get; set; }
|
||||
public string autoinput { get; set; }
|
||||
public Nullable<bool> enable { get; set; }
|
||||
public string jobgrp { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class EETGW_LoginInfo
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public string uid { get; set; }
|
||||
public Nullable<System.DateTime> login { get; set; }
|
||||
public string ip { get; set; }
|
||||
public string hostname { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public Nullable<System.DateTime> wdate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class EETGW_ProjectToDo
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public int pidx { get; set; }
|
||||
public Nullable<int> pseq { get; set; }
|
||||
public Nullable<int> sw { get; set; }
|
||||
public Nullable<int> ww { get; set; }
|
||||
public string sort { get; set; }
|
||||
public string cate { get; set; }
|
||||
public string title { get; set; }
|
||||
public string pdate { get; set; }
|
||||
public string edate { get; set; }
|
||||
public Nullable<int> process { get; set; }
|
||||
public string remark { get; set; }
|
||||
public string remark2 { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class EETGW_ProjecthistoryD
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public int pidx { get; set; }
|
||||
public string pdate { get; set; }
|
||||
public string div { get; set; }
|
||||
public string remark { get; set; }
|
||||
public string remark2 { get; set; }
|
||||
public Nullable<bool> mailsend { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class EETGW_ProjectsSchedule
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public string gcode { get; set; }
|
||||
public Nullable<int> project { get; set; }
|
||||
public Nullable<int> no { get; set; }
|
||||
public Nullable<int> seq { get; set; }
|
||||
public string title { get; set; }
|
||||
public Nullable<int> sw { get; set; }
|
||||
public Nullable<int> ew { get; set; }
|
||||
public Nullable<int> swa { get; set; }
|
||||
public Nullable<int> ewa { get; set; }
|
||||
public string uid { get; set; }
|
||||
public string memo { get; set; }
|
||||
public Nullable<int> appoval { get; set; }
|
||||
public Nullable<int> progress { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class HolidayLIst
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public string pdate { get; set; }
|
||||
public Nullable<bool> free { get; set; }
|
||||
public string memo { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Items
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public Nullable<bool> disable { get; set; }
|
||||
public string gcode { get; set; }
|
||||
public string cate { get; set; }
|
||||
public string name { get; set; }
|
||||
public string sid { get; set; }
|
||||
public string model { get; set; }
|
||||
public string manu { get; set; }
|
||||
public Nullable<double> scale { get; set; }
|
||||
public string unit { get; set; }
|
||||
public string supply { get; set; }
|
||||
public Nullable<int> supplyidx { get; set; }
|
||||
public Nullable<decimal> price { get; set; }
|
||||
public string memo { get; set; }
|
||||
public byte[] image { get; set; }
|
||||
public Nullable<bool> bparam1 { get; set; }
|
||||
public Nullable<int> iparam1 { get; set; }
|
||||
public string import { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
public Nullable<bool> bEstimate { get; set; }
|
||||
public Nullable<bool> bSAP { get; set; }
|
||||
public Nullable<decimal> priceD { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class JobReport
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public string gcode { get; set; }
|
||||
public string pdate { get; set; }
|
||||
public Nullable<int> pidx { get; set; }
|
||||
public string projectName { get; set; }
|
||||
public string uid { get; set; }
|
||||
public string requestpart { get; set; }
|
||||
public string package { get; set; }
|
||||
public string status { get; set; }
|
||||
public string type { get; set; }
|
||||
public string process { get; set; }
|
||||
public string description { get; set; }
|
||||
public string remark { get; set; }
|
||||
public Nullable<double> hrs { get; set; }
|
||||
public Nullable<double> ot { get; set; }
|
||||
public Nullable<bool> import { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
public string description2 { get; set; }
|
||||
public string tag { get; set; }
|
||||
public Nullable<bool> autoinput { get; set; }
|
||||
public Nullable<System.DateTime> otStart { get; set; }
|
||||
public Nullable<System.DateTime> otEnd { get; set; }
|
||||
public string kisullv { get; set; }
|
||||
public string kisuldiv { get; set; }
|
||||
public Nullable<decimal> kisulamt { get; set; }
|
||||
public Nullable<double> ot2 { get; set; }
|
||||
public string otReason { get; set; }
|
||||
public string otwuid { get; set; }
|
||||
public Nullable<System.DateTime> ottime { get; set; }
|
||||
public string jobgrp { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
public partial class EEEntitiesCommon : DbContext
|
||||
{
|
||||
public EEEntitiesCommon()
|
||||
: base("name=EEEntitiesCommon")
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
throw new UnintentionalCodeFirstException();
|
||||
}
|
||||
|
||||
public virtual DbSet<Customs> Customs { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,636 +0,0 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"ModelCommon.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/ModelCommon.Designer.cs
generated
10
Project/ModelCommon.Designer.cs
generated
@@ -1,10 +0,0 @@
|
||||
// 모델 'D:\Source\##### 완료아이템\(014) GroupWare\Source\Project\ModelCommon.edmx'에 대해 T4 코드 생성이 사용됩니다.
|
||||
// 레거시 코드 생성을 사용하려면 '코드 생성 전략' 디자이너 속성의 값을
|
||||
// 'Legacy ObjectContext'로 변경하십시오. 이 속성은 모델이 디자이너에서 열릴 때
|
||||
// 속성 창에서 사용할 수 있습니다.
|
||||
|
||||
// 컨텍스트 및 엔터티 클래스가 생성되지 않은 경우 빈 모델을 만들었기 때문일 수도 있지만
|
||||
// 사용할 Entity Framework 버전을 선택하지 않았기 때문일 수도 있습니다. 모델에 맞는 컨텍스트 클래스 및
|
||||
// 엔터티 클래스를 생성하려면 디자이너에서 모델을 열고 디자이너 화면에서 마우스 오른쪽 단추를 클릭한
|
||||
// 다음 '데이터베이스에서 모델 업데이트...', '모델에서 데이터베이스 생성...' 또는 '코드 생성 항목 추가...'를
|
||||
// 선택하십시오.
|
||||
@@ -1,9 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
<?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="EEModelCommon.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="Customs">
|
||||
<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="grp" Type="varchar" MaxLength="20" />
|
||||
<Property Name="uptae" Type="varchar" MaxLength="100" />
|
||||
<Property Name="name" Type="nvarchar" MaxLength="100" />
|
||||
<Property Name="name2" Type="nvarchar" MaxLength="100" />
|
||||
<Property Name="owner" Type="nvarchar" MaxLength="50" />
|
||||
<Property Name="ownertel" Type="nvarchar" MaxLength="50" />
|
||||
<Property Name="address" Type="nvarchar" MaxLength="255" />
|
||||
<Property Name="tel" Type="varchar" MaxLength="150" />
|
||||
<Property Name="fax" Type="varchar" MaxLength="100" />
|
||||
<Property Name="email" Type="varchar" MaxLength="100" />
|
||||
<Property Name="memo" Type="nvarchar" MaxLength="255" />
|
||||
<Property Name="staff" Type="nvarchar" MaxLength="250" />
|
||||
<Property Name="stafftel" Type="varchar" MaxLength="150" />
|
||||
<Property Name="wuid" Type="varchar" MaxLength="20" Nullable="false" />
|
||||
<Property Name="wdate" Type="smalldatetime" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityContainer Name="EEModelCommonStoreContainer">
|
||||
<EntitySet Name="Customs" EntityType="Self.Customs" Schema="dbo" store:Type="Tables" />
|
||||
</EntityContainer>
|
||||
</Schema>
|
||||
</edmx:StorageModels>
|
||||
<!-- CSDL content -->
|
||||
<edmx:ConceptualModels>
|
||||
<Schema Namespace="EEModelCommon" 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="Customs">
|
||||
<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="grp" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
|
||||
<Property Name="uptae" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
<Property Name="name" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
|
||||
<Property Name="name2" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
|
||||
<Property Name="owner" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
|
||||
<Property Name="ownertel" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
|
||||
<Property Name="address" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
|
||||
<Property Name="tel" Type="String" MaxLength="150" FixedLength="false" Unicode="false" />
|
||||
<Property Name="fax" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
<Property Name="email" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
<Property Name="memo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
|
||||
<Property Name="staff" Type="String" MaxLength="250" FixedLength="false" Unicode="true" />
|
||||
<Property Name="stafftel" Type="String" MaxLength="150" 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>
|
||||
<EntityContainer Name="EEEntitiesCommon" annotation:LazyLoadingEnabled="true">
|
||||
<EntitySet Name="Customs" EntityType="Self.Customs" />
|
||||
</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="EEModelCommonStoreContainer" CdmEntityContainer="EEEntitiesCommon">
|
||||
<EntitySetMapping Name="Customs">
|
||||
<EntityTypeMapping TypeName="EEModelCommon.Customs">
|
||||
<MappingFragment StoreEntitySet="Customs">
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
<ScalarProperty Name="gcode" ColumnName="gcode" />
|
||||
<ScalarProperty Name="grp" ColumnName="grp" />
|
||||
<ScalarProperty Name="uptae" ColumnName="uptae" />
|
||||
<ScalarProperty Name="name" ColumnName="name" />
|
||||
<ScalarProperty Name="name2" ColumnName="name2" />
|
||||
<ScalarProperty Name="owner" ColumnName="owner" />
|
||||
<ScalarProperty Name="ownertel" ColumnName="ownertel" />
|
||||
<ScalarProperty Name="address" ColumnName="address" />
|
||||
<ScalarProperty Name="tel" ColumnName="tel" />
|
||||
<ScalarProperty Name="fax" ColumnName="fax" />
|
||||
<ScalarProperty Name="email" ColumnName="email" />
|
||||
<ScalarProperty Name="memo" ColumnName="memo" />
|
||||
<ScalarProperty Name="staff" ColumnName="staff" />
|
||||
<ScalarProperty Name="stafftel" ColumnName="stafftel" />
|
||||
<ScalarProperty Name="wuid" ColumnName="wuid" />
|
||||
<ScalarProperty Name="wdate" ColumnName="wdate" />
|
||||
</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>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?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="a73304291c754683aebd32c8be38c3a9" Name="Diagram1">
|
||||
<EntityTypeShape EntityType="EEModelCommon.Customs" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
|
||||
</Diagram>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
</edmx:Edmx>
|
||||
@@ -1,733 +0,0 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"ModelCommon.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);
|
||||
}
|
||||
}
|
||||
#>
|
||||
@@ -1,31 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
public partial class EEEntitiesJobreport : DbContext
|
||||
{
|
||||
public EEEntitiesJobreport()
|
||||
: base("name=EEEntitiesJobreport")
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
throw new UnintentionalCodeFirstException();
|
||||
}
|
||||
|
||||
public virtual DbSet<JobReport> JobReport { get; set; }
|
||||
public virtual DbSet<vJobReportForUser> vJobReportForUser { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,636 +0,0 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"ModelJobreport.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/ModelJobreport.Designer.cs
generated
10
Project/ModelJobreport.Designer.cs
generated
@@ -1,10 +0,0 @@
|
||||
// 모델 'D:\Source\##### 완료아이템\(0014) GroupWare\Source\Project\ModelJobreport.edmx'에 대해 T4 코드 생성이 사용됩니다.
|
||||
// 레거시 코드 생성을 사용하려면 '코드 생성 전략' 디자이너 속성의 값을
|
||||
// 'Legacy ObjectContext'로 변경하십시오. 이 속성은 모델이 디자이너에서 열릴 때
|
||||
// 속성 창에서 사용할 수 있습니다.
|
||||
|
||||
// 컨텍스트 및 엔터티 클래스가 생성되지 않은 경우 빈 모델을 만들었기 때문일 수도 있지만
|
||||
// 사용할 Entity Framework 버전을 선택하지 않았기 때문일 수도 있습니다. 모델에 맞는 컨텍스트 클래스 및
|
||||
// 엔터티 클래스를 생성하려면 디자이너에서 모델을 열고 디자이너 화면에서 마우스 오른쪽 단추를 클릭한
|
||||
// 다음 '데이터베이스에서 모델 업데이트...', '모델에서 데이터베이스 생성...' 또는 '코드 생성 항목 추가...'를
|
||||
// 선택하십시오.
|
||||
@@ -1,9 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,281 +0,0 @@
|
||||
<?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="EEModelJobreport.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" 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="JobReport">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
<PropertyRef Name="gcode" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
|
||||
<Property Name="gcode" Type="varchar" MaxLength="10" Nullable="false" />
|
||||
<Property Name="pdate" Type="varchar" MaxLength="10" />
|
||||
<Property Name="pidx" Type="int" />
|
||||
<Property Name="projectName" Type="nvarchar" MaxLength="255" />
|
||||
<Property Name="uid" Type="varchar" MaxLength="20" />
|
||||
<Property Name="requestpart" Type="varchar" MaxLength="50" />
|
||||
<Property Name="package" Type="varchar" MaxLength="50" />
|
||||
<Property Name="status" Type="varchar" MaxLength="20" />
|
||||
<Property Name="type" Type="varchar" MaxLength="50" />
|
||||
<Property Name="process" Type="varchar" MaxLength="50" />
|
||||
<Property Name="description" Type="nvarchar(max)" />
|
||||
<Property Name="remark" Type="nvarchar" MaxLength="255" />
|
||||
<Property Name="hrs" Type="float" />
|
||||
<Property Name="ot" Type="float" />
|
||||
<Property Name="otStart" Type="datetime" />
|
||||
<Property Name="otEnd" Type="datetime" />
|
||||
<Property Name="import" Type="bit" />
|
||||
<Property Name="wuid" Type="varchar" MaxLength="20" Nullable="false" />
|
||||
<Property Name="wdate" Type="smalldatetime" Nullable="false" />
|
||||
<Property Name="description2" Type="nvarchar(max)" />
|
||||
<Property Name="tag" Type="varchar" MaxLength="255" />
|
||||
<Property Name="autoinput" Type="bit" />
|
||||
<Property Name="kisullv" Type="varchar" MaxLength="10" />
|
||||
<Property Name="kisuldiv" Type="varchar" MaxLength="100" />
|
||||
<Property Name="kisulamt" Type="decimal" Precision="18" Scale="3" />
|
||||
<Property Name="ot2" Type="float" />
|
||||
<Property Name="otReason" Type="varchar" MaxLength="255" />
|
||||
<Property Name="otwuid" Type="varchar" MaxLength="20" />
|
||||
<Property Name="ottime" Type="datetime" />
|
||||
<Property Name="jobgrp" Type="varchar" MaxLength="50" />
|
||||
</EntityType>
|
||||
<!--생성 중 오류 발생:
|
||||
경고 6002: 테이블/뷰 'EE.dbo.vJobReportForUser'에 기본 키가 정의되지 않았습니다. 키가 유추되었고 읽기 전용 테이블/뷰로 정의되었습니다.-->
|
||||
<EntityType Name="vJobReportForUser">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
<PropertyRef Name="gcode" />
|
||||
|
||||
|
||||
|
||||
</Key>
|
||||
<Property Name="idx" Type="int" Nullable="false" />
|
||||
<Property Name="pdate" Type="varchar" MaxLength="10" />
|
||||
<Property Name="gcode" Type="varchar" MaxLength="10" Nullable="false" />
|
||||
<Property Name="id" Type="varchar" MaxLength="20" />
|
||||
<Property Name="name" Type="nvarchar" MaxLength="100" />
|
||||
<Property Name="process" Type="varchar" MaxLength="50" Nullable="false" />
|
||||
<Property Name="type" Type="varchar" MaxLength="50" />
|
||||
<Property Name="svalue" Type="varchar" MaxLength="255" />
|
||||
<Property Name="hrs" Type="float" />
|
||||
<Property Name="ot" Type="float" />
|
||||
<Property Name="requestpart" Type="varchar" MaxLength="50" Nullable="false" />
|
||||
<Property Name="package" Type="varchar" MaxLength="50" Nullable="false" />
|
||||
<Property Name="userProcess" Type="varchar" MaxLength="50" />
|
||||
<Property Name="status" Type="varchar" MaxLength="20" />
|
||||
<Property Name="projectName" Type="nvarchar" MaxLength="255" />
|
||||
<Property Name="description" Type="nvarchar(max)" />
|
||||
<Property Name="ww" Type="varchar" MaxLength="6" />
|
||||
<Property Name="otStart" Type="datetime" />
|
||||
<Property Name="otEnd" Type="datetime" />
|
||||
<Property Name="ot2" Type="float" />
|
||||
<Property Name="otReason" Type="varchar" MaxLength="255" />
|
||||
<Property Name="grade" Type="varchar" MaxLength="10" />
|
||||
<Property Name="indate" Type="varchar" MaxLength="20" />
|
||||
<Property Name="outdate" Type="varchar" MaxLength="20" />
|
||||
</EntityType>
|
||||
<EntityContainer Name="EEModelJobreportStoreContainer">
|
||||
<EntitySet Name="JobReport" EntityType="Self.JobReport" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="vJobReportForUser" EntityType="Self.vJobReportForUser" store:Type="Views" store:Schema="dbo">
|
||||
<DefiningQuery>SELECT
|
||||
[vJobReportForUser].[idx] AS [idx],
|
||||
[vJobReportForUser].[pdate] AS [pdate],
|
||||
[vJobReportForUser].[gcode] AS [gcode],
|
||||
[vJobReportForUser].[id] AS [id],
|
||||
[vJobReportForUser].[name] AS [name],
|
||||
[vJobReportForUser].[process] AS [process],
|
||||
[vJobReportForUser].[type] AS [type],
|
||||
[vJobReportForUser].[svalue] AS [svalue],
|
||||
[vJobReportForUser].[hrs] AS [hrs],
|
||||
[vJobReportForUser].[ot] AS [ot],
|
||||
[vJobReportForUser].[requestpart] AS [requestpart],
|
||||
[vJobReportForUser].[package] AS [package],
|
||||
[vJobReportForUser].[userProcess] AS [userProcess],
|
||||
[vJobReportForUser].[status] AS [status],
|
||||
[vJobReportForUser].[projectName] AS [projectName],
|
||||
[vJobReportForUser].[description] AS [description],
|
||||
[vJobReportForUser].[ww] AS [ww],
|
||||
[vJobReportForUser].[otStart] AS [otStart],
|
||||
[vJobReportForUser].[otEnd] AS [otEnd],
|
||||
[vJobReportForUser].[ot2] AS [ot2],
|
||||
[vJobReportForUser].[otReason] AS [otReason],
|
||||
[vJobReportForUser].[grade] AS [grade],
|
||||
[vJobReportForUser].[indate] AS [indate],
|
||||
[vJobReportForUser].[outdate] AS [outdate]
|
||||
FROM [dbo].[vJobReportForUser] AS [vJobReportForUser]</DefiningQuery>
|
||||
</EntitySet>
|
||||
</EntityContainer>
|
||||
</Schema></edmx:StorageModels>
|
||||
<!-- CSDL content -->
|
||||
<edmx:ConceptualModels>
|
||||
<Schema Namespace="EEModelJobreport" 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="JobReport">
|
||||
<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="pdate" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="pidx" Type="Int32" />
|
||||
<Property Name="projectName" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
|
||||
<Property Name="uid" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
|
||||
<Property Name="requestpart" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="package" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="status" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
|
||||
<Property Name="type" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="process" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="description" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
|
||||
<Property Name="remark" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
|
||||
<Property Name="hrs" Type="Double" />
|
||||
<Property Name="ot" Type="Double" />
|
||||
<Property Name="import" Type="Boolean" />
|
||||
<Property Name="wuid" Type="String" MaxLength="20" FixedLength="false" Unicode="false" Nullable="false" />
|
||||
<Property Name="wdate" Type="DateTime" Nullable="false" Precision="0" />
|
||||
<Property Name="description2" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
|
||||
<Property Name="tag" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
|
||||
<Property Name="autoinput" Type="Boolean" />
|
||||
<Property Name="otStart" Type="DateTime" Precision="3" />
|
||||
<Property Name="otEnd" Type="DateTime" Precision="3" />
|
||||
<Property Name="kisullv" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="kisuldiv" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
<Property Name="kisulamt" Type="Decimal" Precision="18" Scale="3" />
|
||||
<Property Name="ot2" Type="Double" />
|
||||
<Property Name="otReason" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
|
||||
<Property Name="otwuid" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
|
||||
<Property Name="ottime" Type="DateTime" Precision="3" />
|
||||
<Property Name="jobgrp" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="vJobReportForUser">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
<PropertyRef Name="gcode" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="Int32" Nullable="false" />
|
||||
<Property Name="pdate" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="gcode" Type="String" MaxLength="10" FixedLength="false" Unicode="false" Nullable="false" />
|
||||
<Property Name="id" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
|
||||
<Property Name="name" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
|
||||
<Property Name="process" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
|
||||
<Property Name="type" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="svalue" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
|
||||
<Property Name="hrs" Type="Double" />
|
||||
<Property Name="ot" Type="Double" />
|
||||
<Property Name="requestpart" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
|
||||
<Property Name="package" Type="String" MaxLength="50" FixedLength="false" Unicode="false" Nullable="false" />
|
||||
<Property Name="userProcess" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="status" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
|
||||
<Property Name="projectName" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
|
||||
<Property Name="description" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
|
||||
<Property Name="ww" Type="String" MaxLength="6" FixedLength="false" Unicode="false" />
|
||||
<Property Name="otStart" Type="DateTime" Precision="3" />
|
||||
<Property Name="otEnd" Type="DateTime" Precision="3" />
|
||||
<Property Name="ot2" Type="Double" />
|
||||
<Property Name="otReason" Type="String" MaxLength="255" FixedLength="false" Unicode="false" />
|
||||
<Property Name="grade" Type="String" MaxLength="10" 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" />
|
||||
</EntityType>
|
||||
<EntityContainer Name="EEEntitiesJobreport" annotation:LazyLoadingEnabled="true">
|
||||
<EntitySet Name="JobReport" EntityType="Self.JobReport" />
|
||||
<EntitySet Name="vJobReportForUser" EntityType="Self.vJobReportForUser" />
|
||||
</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="EEModelJobreportStoreContainer" CdmEntityContainer="EEEntitiesJobreport">
|
||||
<EntitySetMapping Name="JobReport">
|
||||
<EntityTypeMapping TypeName="EEModelJobreport.JobReport">
|
||||
<MappingFragment StoreEntitySet="JobReport">
|
||||
<ScalarProperty Name="jobgrp" ColumnName="jobgrp" />
|
||||
<ScalarProperty Name="ottime" ColumnName="ottime" />
|
||||
<ScalarProperty Name="otwuid" ColumnName="otwuid" />
|
||||
<ScalarProperty Name="otReason" ColumnName="otReason" />
|
||||
<ScalarProperty Name="ot2" ColumnName="ot2" />
|
||||
<ScalarProperty Name="kisulamt" ColumnName="kisulamt" />
|
||||
<ScalarProperty Name="kisuldiv" ColumnName="kisuldiv" />
|
||||
<ScalarProperty Name="kisullv" ColumnName="kisullv" />
|
||||
<ScalarProperty Name="otEnd" ColumnName="otEnd" />
|
||||
<ScalarProperty Name="otStart" ColumnName="otStart" />
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
<ScalarProperty Name="gcode" ColumnName="gcode" />
|
||||
<ScalarProperty Name="pdate" ColumnName="pdate" />
|
||||
<ScalarProperty Name="pidx" ColumnName="pidx" />
|
||||
<ScalarProperty Name="projectName" ColumnName="projectName" />
|
||||
<ScalarProperty Name="uid" ColumnName="uid" />
|
||||
<ScalarProperty Name="requestpart" ColumnName="requestpart" />
|
||||
<ScalarProperty Name="package" ColumnName="package" />
|
||||
<ScalarProperty Name="status" ColumnName="status" />
|
||||
<ScalarProperty Name="type" ColumnName="type" />
|
||||
<ScalarProperty Name="process" ColumnName="process" />
|
||||
<ScalarProperty Name="description" ColumnName="description" />
|
||||
<ScalarProperty Name="remark" ColumnName="remark" />
|
||||
<ScalarProperty Name="hrs" ColumnName="hrs" />
|
||||
<ScalarProperty Name="ot" ColumnName="ot" />
|
||||
<ScalarProperty Name="import" ColumnName="import" />
|
||||
<ScalarProperty Name="wuid" ColumnName="wuid" />
|
||||
<ScalarProperty Name="wdate" ColumnName="wdate" />
|
||||
<ScalarProperty Name="description2" ColumnName="description2" />
|
||||
<ScalarProperty Name="tag" ColumnName="tag" />
|
||||
<ScalarProperty Name="autoinput" ColumnName="autoinput" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="vJobReportForUser">
|
||||
<EntityTypeMapping TypeName="EEModelJobreport.vJobReportForUser">
|
||||
<MappingFragment StoreEntitySet="vJobReportForUser">
|
||||
<ScalarProperty Name="outdate" ColumnName="outdate" />
|
||||
<ScalarProperty Name="indate" ColumnName="indate" />
|
||||
<ScalarProperty Name="grade" ColumnName="grade" />
|
||||
<ScalarProperty Name="otReason" ColumnName="otReason" />
|
||||
<ScalarProperty Name="ot2" ColumnName="ot2" />
|
||||
<ScalarProperty Name="otEnd" ColumnName="otEnd" />
|
||||
<ScalarProperty Name="otStart" ColumnName="otStart" />
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
<ScalarProperty Name="pdate" ColumnName="pdate" />
|
||||
<ScalarProperty Name="gcode" ColumnName="gcode" />
|
||||
<ScalarProperty Name="id" ColumnName="id" />
|
||||
<ScalarProperty Name="name" ColumnName="name" />
|
||||
<ScalarProperty Name="process" ColumnName="process" />
|
||||
<ScalarProperty Name="type" ColumnName="type" />
|
||||
<ScalarProperty Name="svalue" ColumnName="svalue" />
|
||||
<ScalarProperty Name="hrs" ColumnName="hrs" />
|
||||
<ScalarProperty Name="ot" ColumnName="ot" />
|
||||
<ScalarProperty Name="requestpart" ColumnName="requestpart" />
|
||||
<ScalarProperty Name="package" ColumnName="package" />
|
||||
<ScalarProperty Name="userProcess" ColumnName="userProcess" />
|
||||
<ScalarProperty Name="status" ColumnName="status" />
|
||||
<ScalarProperty Name="projectName" ColumnName="projectName" />
|
||||
<ScalarProperty Name="description" ColumnName="description" />
|
||||
<ScalarProperty Name="ww" ColumnName="ww" />
|
||||
</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>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?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="d15b4808b6354697aa0b490304e8d3d7" Name="Diagram1">
|
||||
<EntityTypeShape EntityType="EEModelJobreport.JobReport" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EEModelJobreport.vJobReportForUser" Width="1.5" PointX="2.75" PointY="0.75" IsExpanded="true" />
|
||||
</Diagram>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
</edmx:Edmx>
|
||||
@@ -1,733 +0,0 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"ModelJobreport.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);
|
||||
}
|
||||
}
|
||||
#>
|
||||
@@ -1,37 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
public partial class EEEntitiesProject : DbContext
|
||||
{
|
||||
public EEEntitiesProject()
|
||||
: base("name=EEEntitiesProject")
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
throw new UnintentionalCodeFirstException();
|
||||
}
|
||||
|
||||
public virtual DbSet<EETGW_ProjecthistoryD> EETGW_ProjecthistoryD { get; set; }
|
||||
public virtual DbSet<EETGW_ProjectToDo> EETGW_ProjectToDo { get; set; }
|
||||
public virtual DbSet<Projects> Projects { get; set; }
|
||||
public virtual DbSet<ProjectsHistory> ProjectsHistory { get; set; }
|
||||
public virtual DbSet<ProjectsIOMap> ProjectsIOMap { get; set; }
|
||||
public virtual DbSet<ProjectsMailList> ProjectsMailList { get; set; }
|
||||
public virtual DbSet<ProjectsPart> ProjectsPart { get; set; }
|
||||
public virtual DbSet<EETGW_ProjectsSchedule> EETGW_ProjectsSchedule { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,636 +0,0 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"ModelProject.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/ModelProject.Designer.cs
generated
10
Project/ModelProject.Designer.cs
generated
@@ -1,10 +0,0 @@
|
||||
// 모델 'D:\Source\##### 완료아이템\(014) GroupWare\Source\Project\ModelProject.edmx'에 대해 T4 코드 생성이 사용됩니다.
|
||||
// 레거시 코드 생성을 사용하려면 '코드 생성 전략' 디자이너 속성의 값을
|
||||
// 'Legacy ObjectContext'로 변경하십시오. 이 속성은 모델이 디자이너에서 열릴 때
|
||||
// 속성 창에서 사용할 수 있습니다.
|
||||
|
||||
// 컨텍스트 및 엔터티 클래스가 생성되지 않은 경우 빈 모델을 만들었기 때문일 수도 있지만
|
||||
// 사용할 Entity Framework 버전을 선택하지 않았기 때문일 수도 있습니다. 모델에 맞는 컨텍스트 클래스 및
|
||||
// 엔터티 클래스를 생성하려면 디자이너에서 모델을 열고 디자이너 화면에서 마우스 오른쪽 단추를 클릭한
|
||||
// 다음 '데이터베이스에서 모델 업데이트...', '모델에서 데이터베이스 생성...' 또는 '코드 생성 항목 추가...'를
|
||||
// 선택하십시오.
|
||||
@@ -1,9 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,636 +0,0 @@
|
||||
<?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="EEModelProject.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_ProjecthistoryD">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="pidx" Type="int" Nullable="false" />
|
||||
<Property Name="pdate" Type="varchar" MaxLength="10" />
|
||||
<Property Name="div" Type="varchar" MaxLength="10" />
|
||||
<Property Name="remark" Type="varchar(max)" />
|
||||
<Property Name="remark2" Type="varchar(max)" />
|
||||
<Property Name="mailsend" Type="bit" />
|
||||
<Property Name="wuid" Type="varchar" MaxLength="20" Nullable="false" />
|
||||
<Property Name="wdate" Type="smalldatetime" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="EETGW_ProjectsSchedule">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="gcode" Type="varchar" MaxLength="20" />
|
||||
<Property Name="project" Type="int" />
|
||||
<Property Name="no" Type="int" />
|
||||
<Property Name="seq" Type="int" />
|
||||
<Property Name="title" Type="varchar" MaxLength="100" />
|
||||
<Property Name="sw" Type="int" />
|
||||
<Property Name="ew" Type="int" />
|
||||
<Property Name="swa" Type="int" />
|
||||
<Property Name="ewa" Type="int" />
|
||||
<Property Name="uid" Type="varchar" MaxLength="50" />
|
||||
<Property Name="memo" Type="varchar(max)" />
|
||||
<Property Name="appoval" Type="int" />
|
||||
<Property Name="progress" Type="int" />
|
||||
<Property Name="wuid" Type="varchar" MaxLength="20" Nullable="false" />
|
||||
<Property Name="wdate" Type="smalldatetime" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="EETGW_ProjectToDo">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="pidx" Type="int" Nullable="false" />
|
||||
<Property Name="pseq" Type="int" />
|
||||
<Property Name="sw" Type="int" />
|
||||
<Property Name="ww" Type="int" />
|
||||
<Property Name="sort" Type="varchar" MaxLength="2" />
|
||||
<Property Name="cate" Type="nvarchar" MaxLength="100" />
|
||||
<Property Name="title" Type="nvarchar" MaxLength="255" />
|
||||
<Property Name="pdate" Type="varchar" MaxLength="10" />
|
||||
<Property Name="edate" Type="varchar" MaxLength="10" />
|
||||
<Property Name="process" Type="int" />
|
||||
<Property Name="remark" Type="varchar(max)" />
|
||||
<Property Name="remark2" Type="varchar(max)" />
|
||||
<Property Name="wuid" Type="varchar" MaxLength="20" Nullable="false" />
|
||||
<Property Name="wdate" Type="smalldatetime" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="Projects">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="pidx" Type="int" />
|
||||
<Property Name="gcode" Type="varchar" MaxLength="10" Nullable="false" />
|
||||
<Property Name="isdel" Type="bit" />
|
||||
<Property Name="category" Type="varchar" MaxLength="50" />
|
||||
<Property Name="status" Type="varchar" MaxLength="50" />
|
||||
<Property Name="asset" Type="varchar" MaxLength="100" />
|
||||
<Property Name="level" Type="int" />
|
||||
<Property Name="rev" Type="int" />
|
||||
<Property Name="process" Type="varchar" MaxLength="50" />
|
||||
<Property Name="part" Type="varchar" MaxLength="50" />
|
||||
<Property Name="pdate" Type="varchar" MaxLength="10" />
|
||||
<Property Name="name" Type="nvarchar" MaxLength="255" />
|
||||
<Property Name="userManager" Type="varchar" MaxLength="50" />
|
||||
<Property Name="usermain" Type="varchar" MaxLength="50" />
|
||||
<Property Name="usersub" Type="varchar" MaxLength="50" />
|
||||
<Property Name="userhw2" Type="varchar" MaxLength="50" />
|
||||
<Property Name="reqstaff" Type="varchar" MaxLength="50" />
|
||||
<Property Name="costo" Type="float" />
|
||||
<Property Name="costn" Type="float" />
|
||||
<Property Name="cnt" Type="int" />
|
||||
<Property Name="remark_req" Type="varchar(max)" />
|
||||
<Property Name="remark_ans" Type="varchar(max)" />
|
||||
<Property Name="sdate" Type="varchar" MaxLength="50" />
|
||||
<Property Name="ddate" Type="varchar" MaxLength="50" />
|
||||
<Property Name="edate" Type="varchar" MaxLength="50" />
|
||||
<Property Name="odate" Type="varchar" MaxLength="50" />
|
||||
<Property Name="progress" Type="int" />
|
||||
<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="orderno" Type="varchar" MaxLength="50" />
|
||||
<Property Name="crdue" Type="varchar" MaxLength="10" />
|
||||
<Property Name="import" Type="bit" />
|
||||
<Property Name="path" Type="varchar" MaxLength="300" />
|
||||
<Property Name="userprocess" Type="nvarchar" MaxLength="100" />
|
||||
<Property Name="CMP_Background" Type="nvarchar(max)" />
|
||||
<Property Name="CMP_Description" Type="nvarchar(max)" />
|
||||
<Property Name="CMP_Before" Type="nvarchar(max)" />
|
||||
<Property Name="CMP_After" Type="nvarchar(max)" />
|
||||
<Property Name="bCost" Type="bit" />
|
||||
<Property Name="bFanOut" Type="bit" />
|
||||
<Property Name="div" Type="varchar" MaxLength="2" />
|
||||
<Property Name="EB_Site" Type="varchar" MaxLength="20" />
|
||||
<Property Name="EB_Line" Type="varchar" MaxLength="10" />
|
||||
<Property Name="EB_Team" Type="varchar" MaxLength="10" />
|
||||
<Property Name="EB_Model" Type="varchar" MaxLength="100" />
|
||||
<Property Name="EB_OutSourceName" Type="varchar" MaxLength="100" />
|
||||
<Property Name="EB_RepairTime" Type="float" />
|
||||
<Property Name="EB_ConstNew" Type="float" />
|
||||
<Property Name="EB_BoardName" Type="nvarchar" MaxLength="255" />
|
||||
</EntityType>
|
||||
<EntityType Name="ProjectsHistory">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="pidx" Type="int" Nullable="false" />
|
||||
<Property Name="pdate" Type="varchar" MaxLength="10" />
|
||||
<Property Name="div" Type="varchar" MaxLength="10" />
|
||||
<Property Name="remark" Type="varchar(max)" />
|
||||
<Property Name="remark2" Type="varchar(max)" />
|
||||
<Property Name="mailsend" Type="bit" />
|
||||
<Property Name="wuid" Type="varchar" MaxLength="20" Nullable="false" />
|
||||
<Property Name="wdate" Type="smalldatetime" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="ProjectsIOMap">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="Project" Type="int" />
|
||||
<Property Name="Dir" Type="varchar" MaxLength="20" />
|
||||
<Property Name="PIn" Type="varchar" MaxLength="100" />
|
||||
<Property Name="Description" Type="varchar" MaxLength="100" />
|
||||
<Property Name="Remark" Type="varchar" MaxLength="100" />
|
||||
<Property Name="wuid" Type="varchar" MaxLength="20" Nullable="false" />
|
||||
<Property Name="wdate" Type="smalldatetime" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="ProjectsMailList">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="Project" Type="int" />
|
||||
<Property Name="enable" Type="bit" />
|
||||
<Property Name="div" Type="varchar" MaxLength="10" />
|
||||
<Property Name="name" Type="varchar" MaxLength="100" />
|
||||
<Property Name="address" Type="varchar" MaxLength="255" />
|
||||
<Property Name="memo" Type="nvarchar" MaxLength="255" />
|
||||
<Property Name="wuid" Type="varchar" MaxLength="20" Nullable="false" />
|
||||
<Property Name="wdate" Type="smalldatetime" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="ProjectsPart">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="no" Type="int" />
|
||||
<Property Name="Project" Type="int" />
|
||||
<Property Name="ItemGroup" Type="varchar" MaxLength="100" />
|
||||
<Property Name="ItemModel" Type="nvarchar" MaxLength="200" />
|
||||
<Property Name="ItemUnit" Type="varchar" MaxLength="50" />
|
||||
<Property Name="ItemName" Type="nvarchar" MaxLength="200" />
|
||||
<Property Name="ItemSid" Type="varchar" MaxLength="50" />
|
||||
<Property Name="ItemSupply" Type="nvarchar" MaxLength="100" />
|
||||
<Property Name="ItemSupplyidx" Type="int" />
|
||||
<Property Name="ItemManu" Type="nvarchar" MaxLength="100" />
|
||||
<Property Name="Item" Type="int" />
|
||||
<Property Name="option1" Type="nvarchar" MaxLength="255" />
|
||||
<Property Name="option2" Type="nvarchar" MaxLength="255" />
|
||||
<Property Name="option3" Type="nvarchar" MaxLength="255" />
|
||||
<Property Name="qty" Type="int" />
|
||||
<Property Name="qtyn" Type="int" />
|
||||
<Property Name="price" Type="decimal" Precision="18" Scale="0" />
|
||||
<Property Name="amt" Type="decimal" Precision="18" Scale="0" />
|
||||
<Property Name="amtn" Type="decimal" Precision="18" Scale="0" />
|
||||
<Property Name="jago" Type="int" />
|
||||
<Property Name="remark" Type="nvarchar" MaxLength="255" />
|
||||
<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="import" Type="bit" />
|
||||
<Property Name="qtyjago" Type="varchar" MaxLength="50" />
|
||||
<Property Name="qtybuy" Type="int" />
|
||||
<Property Name="qtyin" Type="int" />
|
||||
<Property Name="bbuy" Type="bit" />
|
||||
<Property Name="bconfirm" Type="bit" />
|
||||
<Property Name="bCancel" Type="bit" />
|
||||
</EntityType>
|
||||
<EntityContainer Name="EEModelProjectStoreContainer">
|
||||
<EntitySet Name="EETGW_ProjecthistoryD" EntityType="Self.EETGW_ProjecthistoryD" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="EETGW_ProjectsSchedule" EntityType="Self.EETGW_ProjectsSchedule" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="EETGW_ProjectToDo" EntityType="Self.EETGW_ProjectToDo" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="Projects" EntityType="Self.Projects" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="ProjectsHistory" EntityType="Self.ProjectsHistory" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="ProjectsIOMap" EntityType="Self.ProjectsIOMap" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="ProjectsMailList" EntityType="Self.ProjectsMailList" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="ProjectsPart" EntityType="Self.ProjectsPart" Schema="dbo" store:Type="Tables" />
|
||||
</EntityContainer>
|
||||
</Schema></edmx:StorageModels>
|
||||
<!-- CSDL content -->
|
||||
<edmx:ConceptualModels>
|
||||
<Schema Namespace="EEModelProject" 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_ProjecthistoryD">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="pidx" Type="Int32" Nullable="false" />
|
||||
<Property Name="pdate" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="div" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="remark" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
|
||||
<Property Name="remark2" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
|
||||
<Property Name="mailsend" Type="Boolean" />
|
||||
<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="EETGW_ProjectToDo">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="pidx" Type="Int32" Nullable="false" />
|
||||
<Property Name="pseq" Type="Int32" />
|
||||
<Property Name="sw" Type="Int32" />
|
||||
<Property Name="ww" Type="Int32" />
|
||||
<Property Name="sort" Type="String" MaxLength="2" FixedLength="false" Unicode="false" />
|
||||
<Property Name="cate" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
|
||||
<Property Name="title" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
|
||||
<Property Name="pdate" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="edate" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="process" Type="Int32" />
|
||||
<Property Name="remark" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
|
||||
<Property Name="remark2" Type="String" MaxLength="Max" 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="Projects">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="pidx" Type="Int32" />
|
||||
<Property Name="gcode" Type="String" MaxLength="10" FixedLength="false" Unicode="false" Nullable="false" />
|
||||
<Property Name="isdel" Type="Boolean" />
|
||||
<Property Name="category" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="status" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="asset" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
<Property Name="level" Type="Int32" />
|
||||
<Property Name="rev" Type="Int32" />
|
||||
<Property Name="process" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="part" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="pdate" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="name" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
|
||||
<Property Name="userManager" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="usermain" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="usersub" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="userhw2" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="reqstaff" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="costo" Type="Double" />
|
||||
<Property Name="costn" Type="Double" />
|
||||
<Property Name="cnt" Type="Int32" />
|
||||
<Property Name="remark_req" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
|
||||
<Property Name="remark_ans" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
|
||||
<Property Name="sdate" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="ddate" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="edate" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="odate" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="progress" Type="Int32" />
|
||||
<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="orderno" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="crdue" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="import" Type="Boolean" />
|
||||
<Property Name="path" Type="String" MaxLength="300" FixedLength="false" Unicode="false" />
|
||||
<Property Name="userprocess" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
|
||||
<Property Name="CMP_Background" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
|
||||
<Property Name="CMP_Description" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
|
||||
<Property Name="CMP_Before" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
|
||||
<Property Name="CMP_After" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
|
||||
<Property Name="bCost" Type="Boolean" />
|
||||
<Property Name="bFanOut" Type="Boolean" />
|
||||
<Property Name="div" Type="String" MaxLength="2" FixedLength="false" Unicode="false" />
|
||||
<Property Name="EB_Site" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
|
||||
<Property Name="EB_Line" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="EB_Team" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="EB_Model" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
<Property Name="EB_OutSourceName" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
<Property Name="EB_RepairTime" Type="Double" />
|
||||
<Property Name="EB_ConstNew" Type="Double" />
|
||||
<Property Name="EB_BoardName" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
|
||||
</EntityType>
|
||||
<EntityType Name="ProjectsHistory">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="pidx" Type="Int32" Nullable="false" />
|
||||
<Property Name="pdate" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="div" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="remark" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
|
||||
<Property Name="remark2" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
|
||||
<Property Name="mailsend" Type="Boolean" />
|
||||
<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="ProjectsIOMap">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="Project" Type="Int32" />
|
||||
<Property Name="Dir" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
|
||||
<Property Name="PIn" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
<Property Name="Description" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
<Property Name="Remark" Type="String" MaxLength="100" 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="ProjectsMailList">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="Project" Type="Int32" />
|
||||
<Property Name="enable" Type="Boolean" />
|
||||
<Property Name="div" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="name" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
<Property Name="address" Type="String" MaxLength="255" 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" />
|
||||
</EntityType>
|
||||
<EntityType Name="ProjectsPart">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="no" Type="Int32" />
|
||||
<Property Name="Project" Type="Int32" />
|
||||
<Property Name="ItemGroup" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
<Property Name="ItemModel" Type="String" MaxLength="200" FixedLength="false" Unicode="true" />
|
||||
<Property Name="ItemUnit" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="ItemName" Type="String" MaxLength="200" FixedLength="false" Unicode="true" />
|
||||
<Property Name="ItemSid" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="ItemSupply" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
|
||||
<Property Name="ItemSupplyidx" Type="Int32" />
|
||||
<Property Name="ItemManu" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
|
||||
<Property Name="Item" Type="Int32" />
|
||||
<Property Name="option1" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
|
||||
<Property Name="option2" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
|
||||
<Property Name="option3" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
|
||||
<Property Name="qty" Type="Int32" />
|
||||
<Property Name="qtyn" Type="Int32" />
|
||||
<Property Name="price" Type="Decimal" Precision="18" Scale="0" />
|
||||
<Property Name="amt" Type="Decimal" Precision="18" Scale="0" />
|
||||
<Property Name="amtn" Type="Decimal" Precision="18" Scale="0" />
|
||||
<Property Name="jago" Type="Int32" />
|
||||
<Property Name="remark" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
|
||||
<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="import" Type="Boolean" />
|
||||
<Property Name="qtyjago" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="qtybuy" Type="Int32" />
|
||||
<Property Name="qtyin" Type="Int32" />
|
||||
<Property Name="bbuy" Type="Boolean" />
|
||||
<Property Name="bconfirm" Type="Boolean" />
|
||||
<Property Name="bCancel" Type="Boolean" />
|
||||
</EntityType>
|
||||
<EntityContainer Name="EEEntitiesProject" annotation:LazyLoadingEnabled="true">
|
||||
<EntitySet Name="EETGW_ProjecthistoryD" EntityType="Self.EETGW_ProjecthistoryD" />
|
||||
<EntitySet Name="EETGW_ProjectToDo" EntityType="Self.EETGW_ProjectToDo" />
|
||||
<EntitySet Name="Projects" EntityType="Self.Projects" />
|
||||
<EntitySet Name="ProjectsHistory" EntityType="Self.ProjectsHistory" />
|
||||
<EntitySet Name="ProjectsIOMap" EntityType="Self.ProjectsIOMap" />
|
||||
<EntitySet Name="ProjectsMailList" EntityType="Self.ProjectsMailList" />
|
||||
<EntitySet Name="ProjectsPart" EntityType="Self.ProjectsPart" />
|
||||
<EntitySet Name="EETGW_ProjectsSchedule" EntityType="EEModelProject.EETGW_ProjectsSchedule" />
|
||||
</EntityContainer>
|
||||
<EntityType Name="EETGW_ProjectsSchedule">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="gcode" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
|
||||
<Property Name="project" Type="Int32" />
|
||||
<Property Name="no" Type="Int32" />
|
||||
<Property Name="seq" Type="Int32" />
|
||||
<Property Name="title" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
|
||||
<Property Name="sw" Type="Int32" />
|
||||
<Property Name="ew" Type="Int32" />
|
||||
<Property Name="swa" Type="Int32" />
|
||||
<Property Name="ewa" Type="Int32" />
|
||||
<Property Name="uid" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="memo" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
|
||||
<Property Name="appoval" Type="Int32" />
|
||||
<Property Name="progress" Type="Int32" />
|
||||
<Property Name="wuid" Type="String" Nullable="false" MaxLength="20" FixedLength="false" Unicode="false" />
|
||||
<Property Name="wdate" Type="DateTime" Nullable="false" Precision="0" />
|
||||
</EntityType>
|
||||
</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="EEModelProjectStoreContainer" CdmEntityContainer="EEEntitiesProject">
|
||||
<EntitySetMapping Name="EETGW_ProjecthistoryD">
|
||||
<EntityTypeMapping TypeName="EEModelProject.EETGW_ProjecthistoryD">
|
||||
<MappingFragment StoreEntitySet="EETGW_ProjecthistoryD">
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
<ScalarProperty Name="pidx" ColumnName="pidx" />
|
||||
<ScalarProperty Name="pdate" ColumnName="pdate" />
|
||||
<ScalarProperty Name="div" ColumnName="div" />
|
||||
<ScalarProperty Name="remark" ColumnName="remark" />
|
||||
<ScalarProperty Name="remark2" ColumnName="remark2" />
|
||||
<ScalarProperty Name="mailsend" ColumnName="mailsend" />
|
||||
<ScalarProperty Name="wuid" ColumnName="wuid" />
|
||||
<ScalarProperty Name="wdate" ColumnName="wdate" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="EETGW_ProjectToDo">
|
||||
<EntityTypeMapping TypeName="EEModelProject.EETGW_ProjectToDo">
|
||||
<MappingFragment StoreEntitySet="EETGW_ProjectToDo">
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
<ScalarProperty Name="pidx" ColumnName="pidx" />
|
||||
<ScalarProperty Name="pseq" ColumnName="pseq" />
|
||||
<ScalarProperty Name="sw" ColumnName="sw" />
|
||||
<ScalarProperty Name="ww" ColumnName="ww" />
|
||||
<ScalarProperty Name="sort" ColumnName="sort" />
|
||||
<ScalarProperty Name="cate" ColumnName="cate" />
|
||||
<ScalarProperty Name="title" ColumnName="title" />
|
||||
<ScalarProperty Name="pdate" ColumnName="pdate" />
|
||||
<ScalarProperty Name="edate" ColumnName="edate" />
|
||||
<ScalarProperty Name="process" ColumnName="process" />
|
||||
<ScalarProperty Name="remark" ColumnName="remark" />
|
||||
<ScalarProperty Name="remark2" ColumnName="remark2" />
|
||||
<ScalarProperty Name="wuid" ColumnName="wuid" />
|
||||
<ScalarProperty Name="wdate" ColumnName="wdate" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="Projects">
|
||||
<EntityTypeMapping TypeName="EEModelProject.Projects">
|
||||
<MappingFragment StoreEntitySet="Projects">
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
<ScalarProperty Name="pidx" ColumnName="pidx" />
|
||||
<ScalarProperty Name="gcode" ColumnName="gcode" />
|
||||
<ScalarProperty Name="isdel" ColumnName="isdel" />
|
||||
<ScalarProperty Name="category" ColumnName="category" />
|
||||
<ScalarProperty Name="status" ColumnName="status" />
|
||||
<ScalarProperty Name="asset" ColumnName="asset" />
|
||||
<ScalarProperty Name="level" ColumnName="level" />
|
||||
<ScalarProperty Name="rev" ColumnName="rev" />
|
||||
<ScalarProperty Name="process" ColumnName="process" />
|
||||
<ScalarProperty Name="part" ColumnName="part" />
|
||||
<ScalarProperty Name="pdate" ColumnName="pdate" />
|
||||
<ScalarProperty Name="name" ColumnName="name" />
|
||||
<ScalarProperty Name="userManager" ColumnName="userManager" />
|
||||
<ScalarProperty Name="usermain" ColumnName="usermain" />
|
||||
<ScalarProperty Name="usersub" ColumnName="usersub" />
|
||||
<ScalarProperty Name="userhw2" ColumnName="userhw2" />
|
||||
<ScalarProperty Name="reqstaff" ColumnName="reqstaff" />
|
||||
<ScalarProperty Name="costo" ColumnName="costo" />
|
||||
<ScalarProperty Name="costn" ColumnName="costn" />
|
||||
<ScalarProperty Name="cnt" ColumnName="cnt" />
|
||||
<ScalarProperty Name="remark_req" ColumnName="remark_req" />
|
||||
<ScalarProperty Name="remark_ans" ColumnName="remark_ans" />
|
||||
<ScalarProperty Name="sdate" ColumnName="sdate" />
|
||||
<ScalarProperty Name="ddate" ColumnName="ddate" />
|
||||
<ScalarProperty Name="edate" ColumnName="edate" />
|
||||
<ScalarProperty Name="odate" ColumnName="odate" />
|
||||
<ScalarProperty Name="progress" ColumnName="progress" />
|
||||
<ScalarProperty Name="memo" ColumnName="memo" />
|
||||
<ScalarProperty Name="wuid" ColumnName="wuid" />
|
||||
<ScalarProperty Name="wdate" ColumnName="wdate" />
|
||||
<ScalarProperty Name="orderno" ColumnName="orderno" />
|
||||
<ScalarProperty Name="crdue" ColumnName="crdue" />
|
||||
<ScalarProperty Name="import" ColumnName="import" />
|
||||
<ScalarProperty Name="path" ColumnName="path" />
|
||||
<ScalarProperty Name="userprocess" ColumnName="userprocess" />
|
||||
<ScalarProperty Name="CMP_Background" ColumnName="CMP_Background" />
|
||||
<ScalarProperty Name="CMP_Description" ColumnName="CMP_Description" />
|
||||
<ScalarProperty Name="CMP_Before" ColumnName="CMP_Before" />
|
||||
<ScalarProperty Name="CMP_After" ColumnName="CMP_After" />
|
||||
<ScalarProperty Name="bCost" ColumnName="bCost" />
|
||||
<ScalarProperty Name="bFanOut" ColumnName="bFanOut" />
|
||||
<ScalarProperty Name="div" ColumnName="div" />
|
||||
<ScalarProperty Name="EB_Site" ColumnName="EB_Site" />
|
||||
<ScalarProperty Name="EB_Line" ColumnName="EB_Line" />
|
||||
<ScalarProperty Name="EB_Team" ColumnName="EB_Team" />
|
||||
<ScalarProperty Name="EB_Model" ColumnName="EB_Model" />
|
||||
<ScalarProperty Name="EB_OutSourceName" ColumnName="EB_OutSourceName" />
|
||||
<ScalarProperty Name="EB_RepairTime" ColumnName="EB_RepairTime" />
|
||||
<ScalarProperty Name="EB_ConstNew" ColumnName="EB_ConstNew" />
|
||||
<ScalarProperty Name="EB_BoardName" ColumnName="EB_BoardName" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="ProjectsHistory">
|
||||
<EntityTypeMapping TypeName="EEModelProject.ProjectsHistory">
|
||||
<MappingFragment StoreEntitySet="ProjectsHistory">
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
<ScalarProperty Name="pidx" ColumnName="pidx" />
|
||||
<ScalarProperty Name="pdate" ColumnName="pdate" />
|
||||
<ScalarProperty Name="div" ColumnName="div" />
|
||||
<ScalarProperty Name="remark" ColumnName="remark" />
|
||||
<ScalarProperty Name="remark2" ColumnName="remark2" />
|
||||
<ScalarProperty Name="mailsend" ColumnName="mailsend" />
|
||||
<ScalarProperty Name="wuid" ColumnName="wuid" />
|
||||
<ScalarProperty Name="wdate" ColumnName="wdate" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="ProjectsIOMap">
|
||||
<EntityTypeMapping TypeName="EEModelProject.ProjectsIOMap">
|
||||
<MappingFragment StoreEntitySet="ProjectsIOMap">
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
<ScalarProperty Name="Project" ColumnName="Project" />
|
||||
<ScalarProperty Name="Dir" ColumnName="Dir" />
|
||||
<ScalarProperty Name="PIn" ColumnName="PIn" />
|
||||
<ScalarProperty Name="Description" ColumnName="Description" />
|
||||
<ScalarProperty Name="Remark" ColumnName="Remark" />
|
||||
<ScalarProperty Name="wuid" ColumnName="wuid" />
|
||||
<ScalarProperty Name="wdate" ColumnName="wdate" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="ProjectsMailList">
|
||||
<EntityTypeMapping TypeName="EEModelProject.ProjectsMailList">
|
||||
<MappingFragment StoreEntitySet="ProjectsMailList">
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
<ScalarProperty Name="Project" ColumnName="Project" />
|
||||
<ScalarProperty Name="enable" ColumnName="enable" />
|
||||
<ScalarProperty Name="div" ColumnName="div" />
|
||||
<ScalarProperty Name="name" ColumnName="name" />
|
||||
<ScalarProperty Name="address" ColumnName="address" />
|
||||
<ScalarProperty Name="memo" ColumnName="memo" />
|
||||
<ScalarProperty Name="wuid" ColumnName="wuid" />
|
||||
<ScalarProperty Name="wdate" ColumnName="wdate" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="ProjectsPart">
|
||||
<EntityTypeMapping TypeName="EEModelProject.ProjectsPart">
|
||||
<MappingFragment StoreEntitySet="ProjectsPart">
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
<ScalarProperty Name="no" ColumnName="no" />
|
||||
<ScalarProperty Name="Project" ColumnName="Project" />
|
||||
<ScalarProperty Name="ItemGroup" ColumnName="ItemGroup" />
|
||||
<ScalarProperty Name="ItemModel" ColumnName="ItemModel" />
|
||||
<ScalarProperty Name="ItemUnit" ColumnName="ItemUnit" />
|
||||
<ScalarProperty Name="ItemName" ColumnName="ItemName" />
|
||||
<ScalarProperty Name="ItemSid" ColumnName="ItemSid" />
|
||||
<ScalarProperty Name="ItemSupply" ColumnName="ItemSupply" />
|
||||
<ScalarProperty Name="ItemSupplyidx" ColumnName="ItemSupplyidx" />
|
||||
<ScalarProperty Name="ItemManu" ColumnName="ItemManu" />
|
||||
<ScalarProperty Name="Item" ColumnName="Item" />
|
||||
<ScalarProperty Name="option1" ColumnName="option1" />
|
||||
<ScalarProperty Name="option2" ColumnName="option2" />
|
||||
<ScalarProperty Name="option3" ColumnName="option3" />
|
||||
<ScalarProperty Name="qty" ColumnName="qty" />
|
||||
<ScalarProperty Name="qtyn" ColumnName="qtyn" />
|
||||
<ScalarProperty Name="price" ColumnName="price" />
|
||||
<ScalarProperty Name="amt" ColumnName="amt" />
|
||||
<ScalarProperty Name="amtn" ColumnName="amtn" />
|
||||
<ScalarProperty Name="jago" ColumnName="jago" />
|
||||
<ScalarProperty Name="remark" ColumnName="remark" />
|
||||
<ScalarProperty Name="memo" ColumnName="memo" />
|
||||
<ScalarProperty Name="wuid" ColumnName="wuid" />
|
||||
<ScalarProperty Name="wdate" ColumnName="wdate" />
|
||||
<ScalarProperty Name="import" ColumnName="import" />
|
||||
<ScalarProperty Name="qtyjago" ColumnName="qtyjago" />
|
||||
<ScalarProperty Name="qtybuy" ColumnName="qtybuy" />
|
||||
<ScalarProperty Name="qtyin" ColumnName="qtyin" />
|
||||
<ScalarProperty Name="bbuy" ColumnName="bbuy" />
|
||||
<ScalarProperty Name="bconfirm" ColumnName="bconfirm" />
|
||||
<ScalarProperty Name="bCancel" ColumnName="bCancel" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="EETGW_ProjectsSchedule">
|
||||
<EntityTypeMapping TypeName="EEModelProject.EETGW_ProjectsSchedule">
|
||||
<MappingFragment StoreEntitySet="EETGW_ProjectsSchedule">
|
||||
<ScalarProperty Name="wdate" ColumnName="wdate" />
|
||||
<ScalarProperty Name="wuid" ColumnName="wuid" />
|
||||
<ScalarProperty Name="progress" ColumnName="progress" />
|
||||
<ScalarProperty Name="appoval" ColumnName="appoval" />
|
||||
<ScalarProperty Name="memo" ColumnName="memo" />
|
||||
<ScalarProperty Name="uid" ColumnName="uid" />
|
||||
<ScalarProperty Name="ewa" ColumnName="ewa" />
|
||||
<ScalarProperty Name="swa" ColumnName="swa" />
|
||||
<ScalarProperty Name="ew" ColumnName="ew" />
|
||||
<ScalarProperty Name="sw" ColumnName="sw" />
|
||||
<ScalarProperty Name="title" ColumnName="title" />
|
||||
<ScalarProperty Name="seq" ColumnName="seq" />
|
||||
<ScalarProperty Name="no" ColumnName="no" />
|
||||
<ScalarProperty Name="project" ColumnName="project" />
|
||||
<ScalarProperty Name="gcode" ColumnName="gcode" />
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
</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>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?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="e2d85008b4ed4fe5b32f2efa574b1ec7" Name="Diagram1">
|
||||
<EntityTypeShape EntityType="EEModelProject.EETGW_ProjecthistoryD" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EEModelProject.EETGW_ProjectToDo" Width="1.5" PointX="4.75" PointY="0.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EEModelProject.Projects" Width="1.5" PointX="0.75" PointY="5.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EEModelProject.ProjectsHistory" Width="1.5" PointX="2.75" PointY="5.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EEModelProject.ProjectsIOMap" Width="1.5" PointX="4.75" PointY="5.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EEModelProject.ProjectsMailList" Width="1.5" PointX="6.75" PointY="0.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EEModelProject.ProjectsPart" Width="1.5" PointX="6.75" PointY="4.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EEModelProject.EETGW_ProjectsSchedule" Width="1.5" PointX="9.375" PointY="0.75" />
|
||||
</Diagram>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
</edmx:Edmx>
|
||||
@@ -1,733 +0,0 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"ModelProject.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);
|
||||
}
|
||||
}
|
||||
#>
|
||||
@@ -1,32 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
public partial class EEEntitiesPurchase : DbContext
|
||||
{
|
||||
public EEEntitiesPurchase()
|
||||
: base("name=EEEntitiesPurchase")
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
throw new UnintentionalCodeFirstException();
|
||||
}
|
||||
|
||||
public virtual DbSet<Items> Items { get; set; }
|
||||
public virtual DbSet<Purchase> Purchase { get; set; }
|
||||
public virtual DbSet<vPurchase> vPurchase { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,636 +0,0 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"ModelPurchase.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/ModelPurchase.Designer.cs
generated
10
Project/ModelPurchase.Designer.cs
generated
@@ -1,10 +0,0 @@
|
||||
// 모델 'D:\Source\##### 완료아이템\(014) GroupWare\Source\Project\ModelPurchase.edmx'에 대해 T4 코드 생성이 사용됩니다.
|
||||
// 레거시 코드 생성을 사용하려면 '코드 생성 전략' 디자이너 속성의 값을
|
||||
// 'Legacy ObjectContext'로 변경하십시오. 이 속성은 모델이 디자이너에서 열릴 때
|
||||
// 속성 창에서 사용할 수 있습니다.
|
||||
|
||||
// 컨텍스트 및 엔터티 클래스가 생성되지 않은 경우 빈 모델을 만들었기 때문일 수도 있지만
|
||||
// 사용할 Entity Framework 버전을 선택하지 않았기 때문일 수도 있습니다. 모델에 맞는 컨텍스트 클래스 및
|
||||
// 엔터티 클래스를 생성하려면 디자이너에서 모델을 열고 디자이너 화면에서 마우스 오른쪽 단추를 클릭한
|
||||
// 다음 '데이터베이스에서 모델 업데이트...', '모델에서 데이터베이스 생성...' 또는 '코드 생성 항목 추가...'를
|
||||
// 선택하십시오.
|
||||
@@ -1,9 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,428 +0,0 @@
|
||||
<?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="EEModel.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="Items">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="disable" Type="bit" />
|
||||
<Property Name="gcode" Type="varchar" MaxLength="10" />
|
||||
<Property Name="cate" Type="varchar" MaxLength="50" />
|
||||
<Property Name="name" Type="nvarchar" MaxLength="200" />
|
||||
<Property Name="sid" Type="varchar" MaxLength="50" />
|
||||
<Property Name="model" Type="nvarchar" MaxLength="200" />
|
||||
<Property Name="manu" Type="nvarchar" MaxLength="100" />
|
||||
<Property Name="scale" Type="float" />
|
||||
<Property Name="unit" Type="varchar" MaxLength="50" />
|
||||
<Property Name="supply" Type="nvarchar" MaxLength="100" />
|
||||
<Property Name="supplyidx" Type="int" />
|
||||
<Property Name="price" Type="decimal" Precision="18" Scale="0" />
|
||||
<Property Name="priceD" Type="decimal" Precision="18" Scale="2" />
|
||||
<Property Name="memo" Type="nvarchar" MaxLength="255" />
|
||||
<Property Name="image" Type="varbinary(max)" />
|
||||
<Property Name="bparam1" Type="bit" />
|
||||
<Property Name="iparam1" Type="int" />
|
||||
<Property Name="import" Type="char" MaxLength="1" />
|
||||
<Property Name="wuid" Type="varchar" MaxLength="20" Nullable="false" />
|
||||
<Property Name="wdate" Type="smalldatetime" Nullable="false" />
|
||||
<Property Name="bEstimate" Type="bit" />
|
||||
<Property Name="bSAP" Type="bit" />
|
||||
</EntityType>
|
||||
<EntityType Name="Purchase">
|
||||
<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="pdate" Type="varchar" MaxLength="10" />
|
||||
<Property Name="state" Type="varchar" MaxLength="30" />
|
||||
<Property Name="process" Type="varchar" MaxLength="30" />
|
||||
<Property Name="receive" Type="varchar" MaxLength="50" />
|
||||
<Property Name="sc" Type="varchar" MaxLength="30" />
|
||||
<Property Name="request" Type="varchar" MaxLength="50" />
|
||||
<Property Name="sid" Type="varchar" MaxLength="50" />
|
||||
<Property Name="pumname" Type="nvarchar" MaxLength="200" />
|
||||
<Property Name="pumidx" Type="int" />
|
||||
<Property Name="pumscale" Type="varchar" MaxLength="200" />
|
||||
<Property Name="pumunit" Type="varchar" MaxLength="50" />
|
||||
<Property Name="pumqty" Type="int" />
|
||||
<Property Name="pumprice" Type="decimal" Precision="18" Scale="0" />
|
||||
<Property Name="pumpriceD" Type="decimal" Precision="18" Scale="2" />
|
||||
<Property Name="pumamt" Type="decimal" Precision="18" Scale="0" />
|
||||
<Property Name="supply" Type="varchar" MaxLength="200" />
|
||||
<Property Name="supplyidx" Type="int" />
|
||||
<Property Name="project" Type="varchar(max)" />
|
||||
<Property Name="projectidx" Type="int" />
|
||||
<Property Name="asset" Type="varchar" MaxLength="50" />
|
||||
<Property Name="manuproc" Type="varchar" MaxLength="50" />
|
||||
<Property Name="edate" Type="varchar" MaxLength="10" />
|
||||
<Property Name="indate" Type="varchar" MaxLength="10" />
|
||||
<Property Name="po" Type="varchar" MaxLength="50" />
|
||||
<Property Name="dept" Type="nvarchar" MaxLength="500" />
|
||||
<Property Name="bigo" Type="nvarchar" MaxLength="500" />
|
||||
<Property Name="import" Type="bit" />
|
||||
<Property Name="isdel" Type="bit" />
|
||||
<Property Name="orderno" Type="varchar" MaxLength="50" />
|
||||
<Property Name="place" Type="varchar" MaxLength="20" />
|
||||
<Property Name="wuid" Type="varchar" MaxLength="20" Nullable="false" />
|
||||
<Property Name="wdate" Type="smalldatetime" Nullable="false" />
|
||||
<Property Name="inqty" Type="int" />
|
||||
</EntityType>
|
||||
<!--생성 중 오류 발생:
|
||||
경고 6002: 테이블/뷰 'EE.dbo.vPurchase'에 기본 키가 정의되지 않았습니다. 키가 유추되었고 읽기 전용 테이블/뷰로 정의되었습니다.-->
|
||||
<EntityType Name="vPurchase">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
<PropertyRef Name="gcode" />
|
||||
<PropertyRef Name="wuid" />
|
||||
<PropertyRef Name="wdate" />
|
||||
</Key>
|
||||
<Property Name="name" Type="nvarchar" MaxLength="100" />
|
||||
<Property Name="idx" Type="int" Nullable="false" />
|
||||
<Property Name="gcode" Type="varchar" MaxLength="10" Nullable="false" />
|
||||
<Property Name="pdate" Type="varchar" MaxLength="10" />
|
||||
<Property Name="state" Type="varchar" MaxLength="30" />
|
||||
<Property Name="process" Type="varchar" MaxLength="30" />
|
||||
<Property Name="receive" Type="varchar" MaxLength="50" />
|
||||
<Property Name="sc" Type="varchar" MaxLength="30" />
|
||||
<Property Name="request" Type="varchar" MaxLength="50" />
|
||||
<Property Name="sid" Type="varchar" MaxLength="50" />
|
||||
<Property Name="pumname" Type="nvarchar" MaxLength="200" />
|
||||
<Property Name="pumidx" Type="int" />
|
||||
<Property Name="pumscale" Type="varchar" MaxLength="200" />
|
||||
<Property Name="pumunit" Type="varchar" MaxLength="50" />
|
||||
<Property Name="pumqty" Type="int" />
|
||||
<Property Name="pumprice" Type="decimal" Precision="18" Scale="0" />
|
||||
<Property Name="pumpriceD" Type="decimal" Precision="18" Scale="2" />
|
||||
<Property Name="pumamt" Type="decimal" Precision="18" Scale="0" />
|
||||
<Property Name="supply" Type="varchar" MaxLength="200" />
|
||||
<Property Name="supplyidx" Type="int" />
|
||||
<Property Name="project" Type="varchar(max)" />
|
||||
<Property Name="projectidx" Type="int" />
|
||||
<Property Name="asset" Type="varchar" MaxLength="50" />
|
||||
<Property Name="manuproc" Type="varchar" MaxLength="50" />
|
||||
<Property Name="edate" Type="varchar" MaxLength="10" />
|
||||
<Property Name="indate" Type="varchar" MaxLength="10" />
|
||||
<Property Name="po" Type="varchar" MaxLength="50" />
|
||||
<Property Name="dept" Type="nvarchar" MaxLength="500" />
|
||||
<Property Name="bigo" Type="nvarchar" MaxLength="500" />
|
||||
<Property Name="import" Type="bit" />
|
||||
<Property Name="isdel" Type="bit" />
|
||||
<Property Name="orderno" Type="varchar" MaxLength="50" />
|
||||
<Property Name="place" Type="varchar" MaxLength="20" />
|
||||
<Property Name="wuid" Type="varchar" MaxLength="20" Nullable="false" />
|
||||
<Property Name="wdate" Type="smalldatetime" Nullable="false" />
|
||||
<Property Name="inqty" Type="int" />
|
||||
</EntityType>
|
||||
<EntityContainer Name="EEModelStoreContainer">
|
||||
<EntitySet Name="Items" EntityType="Self.Items" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="Purchase" EntityType="Self.Purchase" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="vPurchase" EntityType="Self.vPurchase" store:Type="Views" store:Schema="dbo">
|
||||
<DefiningQuery>SELECT
|
||||
[vPurchase].[name] AS [name],
|
||||
[vPurchase].[idx] AS [idx],
|
||||
[vPurchase].[gcode] AS [gcode],
|
||||
[vPurchase].[pdate] AS [pdate],
|
||||
[vPurchase].[state] AS [state],
|
||||
[vPurchase].[process] AS [process],
|
||||
[vPurchase].[receive] AS [receive],
|
||||
[vPurchase].[sc] AS [sc],
|
||||
[vPurchase].[request] AS [request],
|
||||
[vPurchase].[sid] AS [sid],
|
||||
[vPurchase].[pumname] AS [pumname],
|
||||
[vPurchase].[pumidx] AS [pumidx],
|
||||
[vPurchase].[pumscale] AS [pumscale],
|
||||
[vPurchase].[pumunit] AS [pumunit],
|
||||
[vPurchase].[pumqty] AS [pumqty],
|
||||
[vPurchase].[pumprice] AS [pumprice],
|
||||
[vPurchase].[pumpriceD] AS [pumpriceD],
|
||||
[vPurchase].[pumamt] AS [pumamt],
|
||||
[vPurchase].[supply] AS [supply],
|
||||
[vPurchase].[supplyidx] AS [supplyidx],
|
||||
[vPurchase].[project] AS [project],
|
||||
[vPurchase].[projectidx] AS [projectidx],
|
||||
[vPurchase].[asset] AS [asset],
|
||||
[vPurchase].[manuproc] AS [manuproc],
|
||||
[vPurchase].[edate] AS [edate],
|
||||
[vPurchase].[indate] AS [indate],
|
||||
[vPurchase].[po] AS [po],
|
||||
[vPurchase].[dept] AS [dept],
|
||||
[vPurchase].[bigo] AS [bigo],
|
||||
[vPurchase].[import] AS [import],
|
||||
[vPurchase].[isdel] AS [isdel],
|
||||
[vPurchase].[orderno] AS [orderno],
|
||||
[vPurchase].[place] AS [place],
|
||||
[vPurchase].[wuid] AS [wuid],
|
||||
[vPurchase].[wdate] AS [wdate],
|
||||
[vPurchase].[inqty] AS [inqty]
|
||||
FROM [dbo].[vPurchase] AS [vPurchase]</DefiningQuery>
|
||||
</EntitySet>
|
||||
</EntityContainer>
|
||||
</Schema></edmx:StorageModels>
|
||||
<!-- CSDL content -->
|
||||
<edmx:ConceptualModels>
|
||||
<Schema Namespace="EEModel" 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="Items">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
</Key>
|
||||
<Property Name="idx" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="disable" Type="Boolean" />
|
||||
<Property Name="gcode" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="cate" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="name" Type="String" MaxLength="200" FixedLength="false" Unicode="true" />
|
||||
<Property Name="sid" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="model" Type="String" MaxLength="200" FixedLength="false" Unicode="true" />
|
||||
<Property Name="manu" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
|
||||
<Property Name="scale" Type="Double" />
|
||||
<Property Name="unit" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="supply" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
|
||||
<Property Name="supplyidx" Type="Int32" />
|
||||
<Property Name="price" Type="Decimal" Precision="18" Scale="0" />
|
||||
<Property Name="memo" Type="String" MaxLength="255" FixedLength="false" Unicode="true" />
|
||||
<Property Name="image" Type="Binary" MaxLength="Max" FixedLength="false" />
|
||||
<Property Name="bparam1" Type="Boolean" />
|
||||
<Property Name="iparam1" Type="Int32" />
|
||||
<Property Name="import" Type="String" MaxLength="1" FixedLength="true" Unicode="false" />
|
||||
<Property Name="wuid" Type="String" MaxLength="20" FixedLength="false" Unicode="false" Nullable="false" />
|
||||
<Property Name="wdate" Type="DateTime" Nullable="false" Precision="0" />
|
||||
<Property Name="bEstimate" Type="Boolean" />
|
||||
<Property Name="bSAP" Type="Boolean" />
|
||||
<Property Name="priceD" Type="Decimal" Precision="18" Scale="2" />
|
||||
</EntityType>
|
||||
<EntityType Name="Purchase">
|
||||
<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="pdate" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="state" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
|
||||
<Property Name="process" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
|
||||
<Property Name="receive" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="sc" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
|
||||
<Property Name="request" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="sid" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="pumname" Type="String" MaxLength="200" FixedLength="false" Unicode="true" />
|
||||
<Property Name="pumidx" Type="Int32" />
|
||||
<Property Name="pumscale" Type="String" MaxLength="200" FixedLength="false" Unicode="false" />
|
||||
<Property Name="pumunit" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="pumqty" Type="Int32" />
|
||||
<Property Name="pumprice" Type="Decimal" Precision="18" Scale="0" />
|
||||
<Property Name="pumamt" Type="Decimal" Precision="18" Scale="0" />
|
||||
<Property Name="supply" Type="String" MaxLength="200" FixedLength="false" Unicode="false" />
|
||||
<Property Name="supplyidx" Type="Int32" />
|
||||
<Property Name="project" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
|
||||
<Property Name="projectidx" Type="Int32" />
|
||||
<Property Name="asset" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="manuproc" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="edate" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="indate" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="po" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="dept" Type="String" MaxLength="500" FixedLength="false" Unicode="true" />
|
||||
<Property Name="bigo" Type="String" MaxLength="500" FixedLength="false" Unicode="true" />
|
||||
<Property Name="import" Type="Boolean" />
|
||||
<Property Name="isdel" Type="Boolean" />
|
||||
<Property Name="orderno" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="place" Type="String" MaxLength="20" 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" />
|
||||
<Property Name="inqty" Type="Int32" />
|
||||
<Property Name="pumpriceD" Type="Decimal" Precision="18" Scale="2" />
|
||||
</EntityType>
|
||||
<EntityContainer Name="EEEntitiesPurchase" annotation:LazyLoadingEnabled="true">
|
||||
<EntitySet Name="Items" EntityType="Self.Items" />
|
||||
<EntitySet Name="Purchase" EntityType="Self.Purchase" />
|
||||
<EntitySet Name="vPurchase" EntityType="EEModel.vPurchase" />
|
||||
</EntityContainer>
|
||||
<EntityType Name="vPurchase">
|
||||
<Key>
|
||||
<PropertyRef Name="idx" />
|
||||
<PropertyRef Name="gcode" />
|
||||
<PropertyRef Name="wuid" />
|
||||
<PropertyRef Name="wdate" />
|
||||
</Key>
|
||||
<Property Name="name" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
|
||||
<Property Name="idx" Type="Int32" Nullable="false" />
|
||||
<Property Name="gcode" Type="String" Nullable="false" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="pdate" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="state" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
|
||||
<Property Name="process" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
|
||||
<Property Name="receive" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="sc" Type="String" MaxLength="30" FixedLength="false" Unicode="false" />
|
||||
<Property Name="request" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="sid" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="pumname" Type="String" MaxLength="200" FixedLength="false" Unicode="true" />
|
||||
<Property Name="pumidx" Type="Int32" />
|
||||
<Property Name="pumscale" Type="String" MaxLength="200" FixedLength="false" Unicode="false" />
|
||||
<Property Name="pumunit" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="pumqty" Type="Int32" />
|
||||
<Property Name="pumprice" Type="Decimal" Precision="18" Scale="0" />
|
||||
<Property Name="pumpriceD" Type="Decimal" Precision="18" Scale="2" />
|
||||
<Property Name="pumamt" Type="Decimal" Precision="18" Scale="0" />
|
||||
<Property Name="supply" Type="String" MaxLength="200" FixedLength="false" Unicode="false" />
|
||||
<Property Name="supplyidx" Type="Int32" />
|
||||
<Property Name="project" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
|
||||
<Property Name="projectidx" Type="Int32" />
|
||||
<Property Name="asset" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="manuproc" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="edate" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="indate" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
|
||||
<Property Name="po" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="dept" Type="String" MaxLength="500" FixedLength="false" Unicode="true" />
|
||||
<Property Name="bigo" Type="String" MaxLength="500" FixedLength="false" Unicode="true" />
|
||||
<Property Name="import" Type="Boolean" />
|
||||
<Property Name="isdel" Type="Boolean" />
|
||||
<Property Name="orderno" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
|
||||
<Property Name="place" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
|
||||
<Property Name="wuid" Type="String" Nullable="false" MaxLength="20" FixedLength="false" Unicode="false" />
|
||||
<Property Name="wdate" Type="DateTime" Nullable="false" Precision="0" />
|
||||
<Property Name="inqty" Type="Int32" />
|
||||
</EntityType>
|
||||
</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="EEModelStoreContainer" CdmEntityContainer="EEEntitiesPurchase">
|
||||
<EntitySetMapping Name="Items">
|
||||
<EntityTypeMapping TypeName="EEModel.Items">
|
||||
<MappingFragment StoreEntitySet="Items">
|
||||
<ScalarProperty Name="priceD" ColumnName="priceD" />
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
<ScalarProperty Name="disable" ColumnName="disable" />
|
||||
<ScalarProperty Name="gcode" ColumnName="gcode" />
|
||||
<ScalarProperty Name="cate" ColumnName="cate" />
|
||||
<ScalarProperty Name="name" ColumnName="name" />
|
||||
<ScalarProperty Name="sid" ColumnName="sid" />
|
||||
<ScalarProperty Name="model" ColumnName="model" />
|
||||
<ScalarProperty Name="manu" ColumnName="manu" />
|
||||
<ScalarProperty Name="scale" ColumnName="scale" />
|
||||
<ScalarProperty Name="unit" ColumnName="unit" />
|
||||
<ScalarProperty Name="supply" ColumnName="supply" />
|
||||
<ScalarProperty Name="supplyidx" ColumnName="supplyidx" />
|
||||
<ScalarProperty Name="price" ColumnName="price" />
|
||||
<ScalarProperty Name="memo" ColumnName="memo" />
|
||||
<ScalarProperty Name="image" ColumnName="image" />
|
||||
<ScalarProperty Name="bparam1" ColumnName="bparam1" />
|
||||
<ScalarProperty Name="iparam1" ColumnName="iparam1" />
|
||||
<ScalarProperty Name="import" ColumnName="import" />
|
||||
<ScalarProperty Name="wuid" ColumnName="wuid" />
|
||||
<ScalarProperty Name="wdate" ColumnName="wdate" />
|
||||
<ScalarProperty Name="bEstimate" ColumnName="bEstimate" />
|
||||
<ScalarProperty Name="bSAP" ColumnName="bSAP" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="Purchase">
|
||||
<EntityTypeMapping TypeName="EEModel.Purchase">
|
||||
<MappingFragment StoreEntitySet="Purchase">
|
||||
<ScalarProperty Name="pumpriceD" ColumnName="pumpriceD" />
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
<ScalarProperty Name="gcode" ColumnName="gcode" />
|
||||
<ScalarProperty Name="pdate" ColumnName="pdate" />
|
||||
<ScalarProperty Name="state" ColumnName="state" />
|
||||
<ScalarProperty Name="process" ColumnName="process" />
|
||||
<ScalarProperty Name="receive" ColumnName="receive" />
|
||||
<ScalarProperty Name="sc" ColumnName="sc" />
|
||||
<ScalarProperty Name="request" ColumnName="request" />
|
||||
<ScalarProperty Name="sid" ColumnName="sid" />
|
||||
<ScalarProperty Name="pumname" ColumnName="pumname" />
|
||||
<ScalarProperty Name="pumidx" ColumnName="pumidx" />
|
||||
<ScalarProperty Name="pumscale" ColumnName="pumscale" />
|
||||
<ScalarProperty Name="pumunit" ColumnName="pumunit" />
|
||||
<ScalarProperty Name="pumqty" ColumnName="pumqty" />
|
||||
<ScalarProperty Name="pumprice" ColumnName="pumprice" />
|
||||
<ScalarProperty Name="pumamt" ColumnName="pumamt" />
|
||||
<ScalarProperty Name="supply" ColumnName="supply" />
|
||||
<ScalarProperty Name="supplyidx" ColumnName="supplyidx" />
|
||||
<ScalarProperty Name="project" ColumnName="project" />
|
||||
<ScalarProperty Name="projectidx" ColumnName="projectidx" />
|
||||
<ScalarProperty Name="asset" ColumnName="asset" />
|
||||
<ScalarProperty Name="manuproc" ColumnName="manuproc" />
|
||||
<ScalarProperty Name="edate" ColumnName="edate" />
|
||||
<ScalarProperty Name="indate" ColumnName="indate" />
|
||||
<ScalarProperty Name="po" ColumnName="po" />
|
||||
<ScalarProperty Name="dept" ColumnName="dept" />
|
||||
<ScalarProperty Name="bigo" ColumnName="bigo" />
|
||||
<ScalarProperty Name="import" ColumnName="import" />
|
||||
<ScalarProperty Name="isdel" ColumnName="isdel" />
|
||||
<ScalarProperty Name="orderno" ColumnName="orderno" />
|
||||
<ScalarProperty Name="place" ColumnName="place" />
|
||||
<ScalarProperty Name="wuid" ColumnName="wuid" />
|
||||
<ScalarProperty Name="wdate" ColumnName="wdate" />
|
||||
<ScalarProperty Name="inqty" ColumnName="inqty" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="vPurchase">
|
||||
<EntityTypeMapping TypeName="EEModel.vPurchase">
|
||||
<MappingFragment StoreEntitySet="vPurchase">
|
||||
<ScalarProperty Name="inqty" ColumnName="inqty" />
|
||||
<ScalarProperty Name="wdate" ColumnName="wdate" />
|
||||
<ScalarProperty Name="wuid" ColumnName="wuid" />
|
||||
<ScalarProperty Name="place" ColumnName="place" />
|
||||
<ScalarProperty Name="orderno" ColumnName="orderno" />
|
||||
<ScalarProperty Name="isdel" ColumnName="isdel" />
|
||||
<ScalarProperty Name="import" ColumnName="import" />
|
||||
<ScalarProperty Name="bigo" ColumnName="bigo" />
|
||||
<ScalarProperty Name="dept" ColumnName="dept" />
|
||||
<ScalarProperty Name="po" ColumnName="po" />
|
||||
<ScalarProperty Name="indate" ColumnName="indate" />
|
||||
<ScalarProperty Name="edate" ColumnName="edate" />
|
||||
<ScalarProperty Name="manuproc" ColumnName="manuproc" />
|
||||
<ScalarProperty Name="asset" ColumnName="asset" />
|
||||
<ScalarProperty Name="projectidx" ColumnName="projectidx" />
|
||||
<ScalarProperty Name="project" ColumnName="project" />
|
||||
<ScalarProperty Name="supplyidx" ColumnName="supplyidx" />
|
||||
<ScalarProperty Name="supply" ColumnName="supply" />
|
||||
<ScalarProperty Name="pumamt" ColumnName="pumamt" />
|
||||
<ScalarProperty Name="pumpriceD" ColumnName="pumpriceD" />
|
||||
<ScalarProperty Name="pumprice" ColumnName="pumprice" />
|
||||
<ScalarProperty Name="pumqty" ColumnName="pumqty" />
|
||||
<ScalarProperty Name="pumunit" ColumnName="pumunit" />
|
||||
<ScalarProperty Name="pumscale" ColumnName="pumscale" />
|
||||
<ScalarProperty Name="pumidx" ColumnName="pumidx" />
|
||||
<ScalarProperty Name="pumname" ColumnName="pumname" />
|
||||
<ScalarProperty Name="sid" ColumnName="sid" />
|
||||
<ScalarProperty Name="request" ColumnName="request" />
|
||||
<ScalarProperty Name="sc" ColumnName="sc" />
|
||||
<ScalarProperty Name="receive" ColumnName="receive" />
|
||||
<ScalarProperty Name="process" ColumnName="process" />
|
||||
<ScalarProperty Name="state" ColumnName="state" />
|
||||
<ScalarProperty Name="pdate" ColumnName="pdate" />
|
||||
<ScalarProperty Name="gcode" ColumnName="gcode" />
|
||||
<ScalarProperty Name="idx" ColumnName="idx" />
|
||||
<ScalarProperty Name="name" ColumnName="name" />
|
||||
</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>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?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="8af6bb3e93b443e58e9543de2aff0f09" Name="Diagram1">
|
||||
<EntityTypeShape EntityType="EEModel.Items" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EEModel.Purchase" Width="1.5" PointX="2.75" PointY="0.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EEModel.vPurchase" Width="1.5" PointX="5.375" PointY="0.75" />
|
||||
</Diagram>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
</edmx:Edmx>
|
||||
@@ -1,733 +0,0 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"ModelPurchase.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);
|
||||
}
|
||||
}
|
||||
#>
|
||||
@@ -18,6 +18,11 @@ namespace Project
|
||||
SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
|
||||
// Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
|
||||
// AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Application.Run(new fMain());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Projects
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public Nullable<int> pidx { get; set; }
|
||||
public string gcode { get; set; }
|
||||
public Nullable<bool> isdel { get; set; }
|
||||
public string category { get; set; }
|
||||
public string status { get; set; }
|
||||
public string asset { get; set; }
|
||||
public Nullable<int> level { get; set; }
|
||||
public Nullable<int> rev { get; set; }
|
||||
public string process { get; set; }
|
||||
public string part { get; set; }
|
||||
public string pdate { get; set; }
|
||||
public string name { get; set; }
|
||||
public string userManager { get; set; }
|
||||
public string usermain { get; set; }
|
||||
public string usersub { get; set; }
|
||||
public string userhw2 { get; set; }
|
||||
public string reqstaff { get; set; }
|
||||
public Nullable<double> costo { get; set; }
|
||||
public Nullable<double> costn { get; set; }
|
||||
public Nullable<int> cnt { get; set; }
|
||||
public string remark_req { get; set; }
|
||||
public string remark_ans { get; set; }
|
||||
public string sdate { get; set; }
|
||||
public string ddate { get; set; }
|
||||
public string edate { get; set; }
|
||||
public string odate { get; set; }
|
||||
public Nullable<int> progress { get; set; }
|
||||
public string memo { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
public string orderno { get; set; }
|
||||
public string crdue { get; set; }
|
||||
public Nullable<bool> import { get; set; }
|
||||
public string path { get; set; }
|
||||
public string userprocess { get; set; }
|
||||
public string CMP_Background { get; set; }
|
||||
public string CMP_Description { get; set; }
|
||||
public string CMP_Before { get; set; }
|
||||
public string CMP_After { get; set; }
|
||||
public Nullable<bool> bCost { get; set; }
|
||||
public Nullable<bool> bFanOut { get; set; }
|
||||
public string div { get; set; }
|
||||
public string EB_Site { get; set; }
|
||||
public string EB_Line { get; set; }
|
||||
public string EB_Team { get; set; }
|
||||
public string EB_Model { get; set; }
|
||||
public string EB_OutSourceName { get; set; }
|
||||
public Nullable<double> EB_RepairTime { get; set; }
|
||||
public Nullable<double> EB_ConstNew { get; set; }
|
||||
public string EB_BoardName { get; set; }
|
||||
public Nullable<bool> bAlert { get; set; }
|
||||
public string bdate { get; set; }
|
||||
public string qdate { get; set; }
|
||||
public string cdate { get; set; }
|
||||
public string CMP_After2 { get; set; }
|
||||
public string model { get; set; }
|
||||
public string serial { get; set; }
|
||||
public string championid { get; set; }
|
||||
public string designid { get; set; }
|
||||
public string assemblyid { get; set; }
|
||||
public string epanelid { get; set; }
|
||||
public string softwareid { get; set; }
|
||||
public string userAssembly { get; set; }
|
||||
public string ReqLine { get; set; }
|
||||
public string ReqSite { get; set; }
|
||||
public string ReqPackage { get; set; }
|
||||
public string ReqPlant { get; set; }
|
||||
public Nullable<int> pno { get; set; }
|
||||
public string kdate { get; set; }
|
||||
public Nullable<int> jasmin { get; set; }
|
||||
public Nullable<double> sfi { get; set; }
|
||||
public string sfi_type { get; set; }
|
||||
public Nullable<double> sfi_savetime { get; set; }
|
||||
public Nullable<double> sfi_savecount { get; set; }
|
||||
public Nullable<double> sfi_shiftcount { get; set; }
|
||||
public Nullable<double> sfic { get; set; }
|
||||
public Nullable<bool> bHighlight { get; set; }
|
||||
public string effect_tangible { get; set; }
|
||||
public string effect_intangible { get; set; }
|
||||
public Nullable<bool> bmajoritem { get; set; }
|
||||
public Nullable<decimal> cramount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class ProjectsHistory
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public int pidx { get; set; }
|
||||
public string pdate { get; set; }
|
||||
public string div { get; set; }
|
||||
public string remark { get; set; }
|
||||
public string remark2 { get; set; }
|
||||
public Nullable<bool> mailsend { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class ProjectsIOMap
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public Nullable<int> Project { get; set; }
|
||||
public string Dir { get; set; }
|
||||
public string PIn { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Remark { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class ProjectsMailList
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public Nullable<int> Project { get; set; }
|
||||
public Nullable<bool> enable { get; set; }
|
||||
public string div { get; set; }
|
||||
public string name { get; set; }
|
||||
public string address { get; set; }
|
||||
public string memo { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class ProjectsPart
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public Nullable<int> no { get; set; }
|
||||
public Nullable<int> Project { get; set; }
|
||||
public string ItemGroup { get; set; }
|
||||
public string ItemModel { get; set; }
|
||||
public string ItemUnit { get; set; }
|
||||
public string ItemName { get; set; }
|
||||
public string ItemSid { get; set; }
|
||||
public string ItemSupply { get; set; }
|
||||
public Nullable<int> ItemSupplyidx { get; set; }
|
||||
public string ItemManu { get; set; }
|
||||
public Nullable<int> Item { get; set; }
|
||||
public string option1 { get; set; }
|
||||
public string option2 { get; set; }
|
||||
public string option3 { get; set; }
|
||||
public Nullable<int> qty { get; set; }
|
||||
public Nullable<int> qtyn { get; set; }
|
||||
public Nullable<decimal> price { get; set; }
|
||||
public Nullable<decimal> amt { get; set; }
|
||||
public Nullable<decimal> amtn { get; set; }
|
||||
public Nullable<int> jago { get; set; }
|
||||
public string remark { get; set; }
|
||||
public string memo { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
public Nullable<bool> import { get; set; }
|
||||
public string qtyjago { get; set; }
|
||||
public Nullable<int> qtybuy { get; set; }
|
||||
public Nullable<int> qtyin { get; set; }
|
||||
public Nullable<bool> bbuy { get; set; }
|
||||
public Nullable<bool> bconfirm { get; set; }
|
||||
public Nullable<bool> bCancel { get; set; }
|
||||
public string reqUser { get; set; }
|
||||
public string recvUser { get; set; }
|
||||
public string recvDate { get; set; }
|
||||
public Nullable<decimal> priceD { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("25.04.05.1530")]
|
||||
[assembly: AssemblyFileVersion("25.04.05.1530")]
|
||||
[assembly: AssemblyVersion("25.04.07.0016")]
|
||||
[assembly: AssemblyFileVersion("25.04.07.0016")]
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Project
|
||||
|
||||
public static DateTime LastInputTime = DateTime.Now;
|
||||
public static CResult Result = new CResult();
|
||||
|
||||
public static DatabaseConnectionString.DatabaseInfo dbinfo = null;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
@@ -152,7 +152,7 @@ namespace Project
|
||||
}
|
||||
|
||||
|
||||
SqlConnection conn = new SqlConnection("Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D!");
|
||||
SqlConnection conn = new SqlConnection(Properties.Settings.Default.CS);// "Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D!" ;
|
||||
conn.Open();
|
||||
string ProcName = "AddPrgmUser3";
|
||||
SqlCommand cmd = new SqlCommand(ProcName, conn);
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Purchase
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public string gcode { get; set; }
|
||||
public string pdate { get; set; }
|
||||
public string state { get; set; }
|
||||
public string process { get; set; }
|
||||
public string receive { get; set; }
|
||||
public string sc { get; set; }
|
||||
public string request { get; set; }
|
||||
public string sid { get; set; }
|
||||
public string pumname { get; set; }
|
||||
public Nullable<int> pumidx { get; set; }
|
||||
public string pumscale { get; set; }
|
||||
public string pumunit { get; set; }
|
||||
public Nullable<int> pumqty { get; set; }
|
||||
public Nullable<decimal> pumprice { get; set; }
|
||||
public Nullable<decimal> pumamt { get; set; }
|
||||
public string supply { get; set; }
|
||||
public Nullable<int> supplyidx { get; set; }
|
||||
public string project { get; set; }
|
||||
public Nullable<int> projectidx { get; set; }
|
||||
public string asset { get; set; }
|
||||
public string manuproc { get; set; }
|
||||
public string edate { get; set; }
|
||||
public string indate { get; set; }
|
||||
public string po { get; set; }
|
||||
public string dept { get; set; }
|
||||
public string bigo { get; set; }
|
||||
public Nullable<bool> import { get; set; }
|
||||
public Nullable<bool> isdel { get; set; }
|
||||
public string orderno { get; set; }
|
||||
public string place { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
public Nullable<int> inqty { get; set; }
|
||||
public Nullable<decimal> pumpriceD { get; set; }
|
||||
public Nullable<int> pumqtyReq { get; set; }
|
||||
public string inremark { get; set; }
|
||||
public string winuid { get; set; }
|
||||
public Nullable<System.DateTime> windate { get; set; }
|
||||
public Nullable<bool> chk1 { get; set; }
|
||||
public Nullable<bool> chk2 { get; set; }
|
||||
public string chkremark { get; set; }
|
||||
public string costcenter { get; set; }
|
||||
public string linecode { get; set; }
|
||||
public string purchase_manager { get; set; }
|
||||
public string purchase_admin { get; set; }
|
||||
public string currency { get; set; }
|
||||
public string prdate { get; set; }
|
||||
public string bigo_admin { get; set; }
|
||||
public string bigo_manager { get; set; }
|
||||
public string conf_status { get; set; }
|
||||
public string conf_request { get; set; }
|
||||
public string conf_reponse { get; set; }
|
||||
public Nullable<int> spmqty { get; set; }
|
||||
public Nullable<bool> UpdateToItem { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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; }
|
||||
public Nullable<bool> advkisul { get; set; }
|
||||
public string managerinfo { get; set; }
|
||||
public string devinfo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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; }
|
||||
}
|
||||
}
|
||||
@@ -34,9 +34,10 @@ namespace Project._Common
|
||||
btChangePW.Enabled = true;
|
||||
|
||||
|
||||
var db = new EEEntitiesMain();
|
||||
var db_user = db.Users.Where(t => t.id == id).FirstOrDefault();
|
||||
var db_guser = db.EETGW_GroupUser.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.uid == id).FirstOrDefault();
|
||||
var taUser = new dsMSSQLTableAdapters.UsersTableAdapter();// EEEntitiesMain();
|
||||
var taGUser = new dsMSSQLTableAdapters.EETGW_GroupUserTableAdapter();
|
||||
var db_user = taUser.GetID(id).FirstOrDefault();// db.Users.Where(t => t.id == id).FirstOrDefault();
|
||||
var db_guser = taGUser.GetbyID(FCOMMON.info.Login.gcode, id).FirstOrDefault();// db.EETGW_GroupUser.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.uid == id).FirstOrDefault();
|
||||
if (db_user != null)
|
||||
{
|
||||
tbNameK.Text = db_user.name;
|
||||
@@ -57,9 +58,9 @@ namespace Project._Common
|
||||
tbState.Text = db_guser.state;
|
||||
|
||||
//this.chkJobReport.Checked = (db_guser.useJobReport == null ? false : (bool)db_guser.useJobReport);
|
||||
this.chkJobReport.Checked = (db_guser.useJobReport == null ? false : (bool)db_guser.useJobReport);
|
||||
this.chkUseState.Checked = (db_guser.useUserState == null ? false : (bool)db_guser.useUserState);
|
||||
this.chkExceptHoly.Checked = (db_guser.exceptHoly == null ? false : (bool)db_guser.exceptHoly);
|
||||
this.chkJobReport.Checked = (db_guser.IsuseJobReportNull() ? false : (bool)db_guser.useJobReport);
|
||||
this.chkUseState.Checked = (db_guser.IsuseUserStateNull() ? false : (bool)db_guser.useUserState);
|
||||
this.chkExceptHoly.Checked = (db_guser.IsexceptHolyNull() ? false : (bool)db_guser.exceptHoly);
|
||||
}
|
||||
|
||||
this.Text = "사용자 정보 변경";
|
||||
@@ -108,8 +109,8 @@ namespace Project._Common
|
||||
return;
|
||||
}
|
||||
|
||||
var db = new EEEntitiesMain();
|
||||
var dr_user = db.Users.Where(t => t.id == id).FirstOrDefault();
|
||||
var db = new dsMSSQLTableAdapters.UsersTableAdapter();// EEEntitiesMain();
|
||||
var dr_user = db.GetID(id).FirstOrDefault();//.Where(t => t.id == id).FirstOrDefault();
|
||||
if (dr_user == null)
|
||||
{
|
||||
FCOMMON.Util.MsgE("등록된 자료가 없습니다");
|
||||
@@ -132,7 +133,8 @@ namespace Project._Common
|
||||
//부서가잇다면 해당 부서에서 해당 사용자의 공정을 찾는다
|
||||
if (tbDept.Text.isEmpty() == false)
|
||||
{
|
||||
var drGrp = db.vGroupUser.Where(t => t.id == id).FirstOrDefault();
|
||||
var tagGUser = new dsMSSQLTableAdapters.vGroupUserTableAdapter();
|
||||
var drGrp = tagGUser.GetOnlyID(id).FirstOrDefault();// db.vGroupUser.Where(t => t.id == id).FirstOrDefault();
|
||||
if (drGrp != null)
|
||||
{
|
||||
tbProcess.Text = drGrp.processs;
|
||||
@@ -175,18 +177,19 @@ namespace Project._Common
|
||||
if (drGuser.level == 0)
|
||||
{
|
||||
int curLevel = Math.Max(FCOMMON.info.Login.level, FCOMMON.DBM.getAuth(FCOMMON.DBM.eAuthType.account));
|
||||
if(curLevel >= 5)
|
||||
if (curLevel >= 5)
|
||||
{
|
||||
FCOMMON.Util.MsgI($"해당 계정이 활성화 됩니다.");
|
||||
drGuser.level = 1;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
FCOMMON.Util.MsgE($"이미 존재하는 사용자 정보입니다\n" +
|
||||
"아직 관리자 승인이 되지 않은 상태입니다\n" +
|
||||
"계정관리자 통해서 계정을 활성화를 하세요");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else FCOMMON.Util.MsgI($"이미 존재하는 사용자 정보입니다\n" + "기존 정보가 업데이트 됩니다");
|
||||
}
|
||||
@@ -271,7 +274,7 @@ namespace Project._Common
|
||||
var cnt1 = taUserGrp.Update(dtUserGrp);
|
||||
var cnt2 = tauser.Update(dtuser);
|
||||
|
||||
if(cnt1 +cnt2 != 2)
|
||||
if (cnt1 + cnt2 != 2)
|
||||
{
|
||||
FCOMMON.Util.MsgE("저장에 문제가 생겼습니다\n관리자에게 문의 하시기 바랍니다");
|
||||
}
|
||||
@@ -310,8 +313,8 @@ namespace Project._Common
|
||||
//해당 그룹에 해당 사용자가 존재하는지 확이한다.
|
||||
var gcode = FCOMMON.info.Login.gcode;
|
||||
var uid = tbId.Text;
|
||||
var db = new EEEntitiesMain();
|
||||
var drUser = db.Users.SingleOrDefault(t => t.id == uid);
|
||||
var db = new dsMSSQLTableAdapters.UsersTableAdapter();// EEEntitiesMain();
|
||||
var drUser = db.GetID(uid).FirstOrDefault();// .Users.SingleOrDefault(t => t.id == uid);
|
||||
if (drUser != null)
|
||||
{
|
||||
if (curLevel < 5 && opass.Equals(drUser.password) == false)
|
||||
|
||||
1
Project/_Common/fUserInfo.Designer.cs
generated
1
Project/_Common/fUserInfo.Designer.cs
generated
@@ -336,7 +336,6 @@
|
||||
this.tam.JobReportTableAdapter = null;
|
||||
this.tam.LineCodeTableAdapter = null;
|
||||
this.tam.ProjectsTableAdapter = null;
|
||||
this.tam.SPMasterTableAdapter = null;
|
||||
this.tam.UpdateOrder = Project.dsMSSQLTableAdapters.TableAdapterManager.UpdateOrderOption.InsertUpdateDelete;
|
||||
this.tam.UserGroupTableAdapter = null;
|
||||
this.tam.UsersTableAdapter = this.ta;
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Windows.Forms;
|
||||
|
||||
namespace Project._Common
|
||||
{
|
||||
public partial class fUserInfo : fBase
|
||||
public partial class fUserInfo : fBase
|
||||
{
|
||||
public fUserInfo()
|
||||
{
|
||||
@@ -22,7 +22,7 @@ namespace Project._Common
|
||||
private void fUserInfo_Load(object sender, EventArgs e)
|
||||
{
|
||||
EnsureVisibleAndUsableSize();
|
||||
this.ta.FillID(this.dsMSSQL.Users,FCOMMON.info.Login.no);
|
||||
this.ta.FillID(this.dsMSSQL.Users, FCOMMON.info.Login.no);
|
||||
dr = this.dsMSSQL.Users.Rows[0] as dsMSSQL.UsersRow;
|
||||
tbKJPath.Text = FCOMMON.DBM.getPathKJ(FCOMMON.info.Login.dept);
|
||||
tbKJPath.Tag = tbKJPath.Text;
|
||||
@@ -31,8 +31,8 @@ namespace Project._Common
|
||||
//this.bs.Filter = "id='" + FCOMMON.info.Login.no + "'";
|
||||
|
||||
//공정은 usergroup에서 찾는다.
|
||||
var db = new EEEntitiesMain();
|
||||
var drGroupUser = db.EETGW_GroupUser.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.uid == FCOMMON.info.Login.no).FirstOrDefault();
|
||||
var db = new dsMSSQLTableAdapters.EETGW_GroupUserTableAdapter();// EEEntitiesMain();
|
||||
var drGroupUser = db.GetbyID(FCOMMON.info.Login.gcode, FCOMMON.info.Login.no).FirstOrDefault();//).EETGW_GroupUser.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.uid == FCOMMON.info.Login.no).FirstOrDefault();
|
||||
if (drGroupUser != null)
|
||||
this.tbProcess.Text = drGroupUser.Process;
|
||||
else this.tbProcess.Text = string.Empty;
|
||||
@@ -97,19 +97,20 @@ namespace Project._Common
|
||||
this.bs.EndEdit();
|
||||
|
||||
|
||||
var db2 = new EEEntitiesMain();
|
||||
var drUserGr = db2.EETGW_GroupUser.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.uid == FCOMMON.info.Login.no).FirstOrDefault();
|
||||
if(dr != null)
|
||||
var db2 = new dsMSSQLTableAdapters.EETGW_GroupUserTableAdapter();// EEEntitiesMain();
|
||||
var drUserGr = db2.GetbyID(FCOMMON.info.Login.gcode, FCOMMON.info.Login.no).FirstOrDefault();// .EETGW_GroupUser.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.uid == FCOMMON.info.Login.no).FirstOrDefault();
|
||||
if (dr != null)
|
||||
{
|
||||
drUserGr.Process = this.tbProcess.Text;
|
||||
db2.SaveChanges();
|
||||
drUserGr.EndEdit();
|
||||
db2.Update(drUserGr);//
|
||||
}
|
||||
|
||||
|
||||
|
||||
// dr.processs = tbProcess.Text;
|
||||
// dr.EndEdit();
|
||||
|
||||
|
||||
|
||||
// dr.processs = tbProcess.Text;
|
||||
// dr.EndEdit();
|
||||
|
||||
try
|
||||
{
|
||||
if (tbKJPath.Enabled)
|
||||
@@ -125,14 +126,14 @@ namespace Project._Common
|
||||
}
|
||||
|
||||
var cnt = this.ta.Update(this.dsMSSQL.Users);
|
||||
if(cnt == 1)
|
||||
if (cnt == 1)
|
||||
{
|
||||
Util.MsgI(string.Format("{0}건의 자료가 업데이트 됨", cnt));
|
||||
DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
Util.MsgE(string.Format("{0}건의 자료가 업데이트 됨", cnt));
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -84,8 +84,8 @@ namespace Project._Common
|
||||
btAdd.Enabled = curLevel >= 5;
|
||||
|
||||
//부서목록 업데이트
|
||||
var db = new EEEntitiesMain();
|
||||
var GrpList = db.UserGroup.Where(t => t.gcode != null && t.permission != null && t.gcode != "" && t.permission > 0);
|
||||
var db = new dsMSSQLTableAdapters.UserGroupTableAdapter();// EEEntitiesMain();
|
||||
var GrpList = db.GetData();//.UserGroup.Where(t => t.gcode != null && t.permission != null && t.gcode != "" && t.permission > 0);
|
||||
|
||||
|
||||
this.cmbdept.Items.Clear();
|
||||
@@ -323,12 +323,15 @@ namespace Project._Common
|
||||
if (dlg != DialogResult.Yes) return;
|
||||
|
||||
//그룹사용자목록에서 삭제만 하면 됨
|
||||
var db = new EEEntitiesMain();
|
||||
var dr_user = db.EETGW_GroupUser.Where(t => t.uid == dr.id).FirstOrDefault();
|
||||
if (dr_user != null) db.EETGW_GroupUser.Remove(dr_user);
|
||||
var cnt = db.SaveChanges();
|
||||
FCOMMON.Util.MsgI($"{cnt}건의 자료가 변경 되었습니다");
|
||||
|
||||
var db = new dsMSSQLTableAdapters.EETGW_GroupUserTableAdapter();// EEEntitiesMain();
|
||||
var dr_user = db.GetbyID(dr.gcode, dr.id).FirstOrDefault();
|
||||
//var dr_user = db.EETGW_GroupUser.Where(t => t.uid == dr.id).FirstOrDefault();
|
||||
if (dr_user != null)
|
||||
{
|
||||
dr_user.Delete();// db.EETGW_GroupUser.Remove(dr_user);
|
||||
var cnt = db.Update(dr_user);
|
||||
FCOMMON.Util.MsgI($"{cnt}건의 자료가 삭제 되었습니다");
|
||||
}
|
||||
RefreshList();
|
||||
}
|
||||
}
|
||||
|
||||
1
Project/_Management/fLineCode.Designer.cs
generated
1
Project/_Management/fLineCode.Designer.cs
generated
@@ -228,7 +228,6 @@
|
||||
this.tam.ItemsTableAdapter = null;
|
||||
this.tam.LineCodeTableAdapter = this.ta;
|
||||
this.tam.ProjectsTableAdapter = null;
|
||||
this.tam.SPMasterTableAdapter = null;
|
||||
this.tam.UpdateOrder = Project.dsMSSQLTableAdapters.TableAdapterManager.UpdateOrderOption.InsertUpdateDelete;
|
||||
this.tam.UserGroupTableAdapter = null;
|
||||
this.tam.UsersTableAdapter = null;
|
||||
|
||||
16150
Project/dsMSSQL.Designer.cs
generated
16150
Project/dsMSSQL.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
2250
Project/dsMSSQL.xsd
2250
Project/dsMSSQL.xsd
File diff suppressed because one or more lines are too long
@@ -4,24 +4,29 @@
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DiagramLayout xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ex:showrelationlabel="False" ViewPortX="465" ViewPortY="-15" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<DiagramLayout xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="-15" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<Shapes>
|
||||
<Shape ID="DesignTable:Users" ZOrder="9" X="997" Y="61" Height="651" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="429" />
|
||||
<Shape ID="DesignTable:Projects" ZOrder="16" X="208" Y="0" Height="149" Width="158" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="59" />
|
||||
<Shape ID="DesignTable:Items" ZOrder="12" X="205" Y="174" Height="476" Width="184" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="197" />
|
||||
<Shape ID="DesignTable:Inventory" ZOrder="15" X="389" Y="17" Height="362" Width="234" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="292" />
|
||||
<Shape ID="DesignTable:LineCode" ZOrder="10" X="586" Y="429" Height="224" Width="189" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="156" />
|
||||
<Shape ID="DesignTable:UserGroup" ZOrder="13" X="396" Y="394" Height="263" Width="158" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="173" />
|
||||
<Shape ID="DesignTable:SPMaster" ZOrder="8" X="802" Y="331" Height="324" Width="200" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:EETGW_GroupUser" ZOrder="11" X="12" Y="283" Height="267" Width="255" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="140" />
|
||||
<Shape ID="DesignTable:vGroupUser" ZOrder="6" X="938" Y="-5" Height="324" Width="227" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:JobReport" ZOrder="7" X="1232" Y="18" Height="305" Width="205" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:MailData" ZOrder="5" X="0" Y="0" Height="381" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:MailAuto" ZOrder="4" X="168" Y="0" Height="324" Width="208" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:BoardFAQ" ZOrder="3" X="73" Y="615" Height="305" Width="179" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:EETGW_LoginInfo" ZOrder="2" X="795" Y="765" Height="210" Width="248" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="159" />
|
||||
<Shape ID="DesignTable:EETGW_JobReport_AutoInput" ZOrder="1" X="466" Y="693" Height="324" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignSources:QueriesTableAdapter" ZOrder="14" X="673" Y="48" Height="220" Width="201" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="216" />
|
||||
<Shape ID="DesignTable:Users" ZOrder="9" X="997" Y="61" Height="381" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:Projects" ZOrder="2" X="208" Y="1" Height="286" Width="191" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="235" />
|
||||
<Shape ID="DesignTable:Items" ZOrder="3" X="74" Y="218" Height="267" Width="177" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="216" />
|
||||
<Shape ID="DesignTable:Inventory" ZOrder="21" X="643" Y="66" Height="324" Width="234" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:LineCode" ZOrder="8" X="586" Y="429" Height="267" Width="199" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="216" />
|
||||
<Shape ID="DesignTable:UserGroup" ZOrder="5" X="430" Y="385" Height="229" Width="208" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="178" />
|
||||
<Shape ID="DesignTable:EETGW_GroupUser" ZOrder="17" X="12" Y="283" Height="324" Width="255" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="235" />
|
||||
<Shape ID="DesignTable:vGroupUser" ZOrder="10" X="938" Y="-5" Height="343" Width="227" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:JobReport" ZOrder="11" X="1243" Y="724" Height="400" Width="292" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:MailData" ZOrder="6" X="434" Y="28" Height="381" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:MailAuto" ZOrder="7" X="460" Y="28" Height="324" Width="208" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:BoardFAQ" ZOrder="4" X="403" Y="247" Height="305" Width="204" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:EETGW_LoginInfo" ZOrder="12" X="1152" Y="566" Height="210" Width="248" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="159" />
|
||||
<Shape ID="DesignTable:EETGW_JobReport_AutoInput" ZOrder="18" X="1184" Y="520" Height="324" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:Purchase" ZOrder="13" X="1327" Y="944" Height="305" Width="197" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:vPurchase" ZOrder="20" X="1237" Y="1036" Height="324" Width="204" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:HolidayLIst" ZOrder="19" X="1218" Y="991" Height="191" Width="210" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="140" />
|
||||
<Shape ID="DesignTable:vFindSID" ZOrder="16" X="1538" Y="959" Height="305" Width="196" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:vJobReportForUser" ZOrder="15" X="1531" Y="972" Height="343" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:Customs" ZOrder="14" X="1362" Y="291" Height="305" Width="195" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignSources:QueriesTableAdapter" ZOrder="1" X="673" Y="84" Height="68" Width="218" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
|
||||
</Shapes>
|
||||
<Connectors />
|
||||
</DiagramLayout>
|
||||
12914
Project/dsProjects.Designer.cs
generated
Normal file
12914
Project/dsProjects.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
9
Project/dsProjects.xsc
Normal file
9
Project/dsProjects.xsc
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DataSetUISetting Version="1.00" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TableUISettings />
|
||||
</DataSetUISetting>
|
||||
1752
Project/dsProjects.xsd
Normal file
1752
Project/dsProjects.xsd
Normal file
File diff suppressed because one or more lines are too long
14
Project/dsProjects.xss
Normal file
14
Project/dsProjects.xss
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool to store the dataset designer's layout information.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DiagramLayout xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="-10" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<Shapes>
|
||||
<Shape ID="DesignTable:Projects" ZOrder="3" X="0" Y="0" Height="343" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:EETGW_ProjectsSchedule" ZOrder="2" X="168" Y="0" Height="305" Width="291" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
<Shape ID="DesignTable:ProjectsPart" ZOrder="1" X="336" Y="0" Height="305" Width="215" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
|
||||
</Shapes>
|
||||
<Connectors />
|
||||
</DiagramLayout>
|
||||
@@ -113,6 +113,8 @@ namespace Project
|
||||
this.Text = Application.ProductName + " v" + Application.ProductVersion;
|
||||
Pub.init();
|
||||
|
||||
|
||||
|
||||
setToolbar();
|
||||
|
||||
|
||||
@@ -122,6 +124,31 @@ namespace Project
|
||||
this.Show();
|
||||
Application.DoEvents();
|
||||
|
||||
|
||||
// 데이터베이스 접속 정보 확인
|
||||
Pub.dbinfo = DatabaseConnectionString.Utility.Read();
|
||||
if (Pub.dbinfo.IsValid == false)
|
||||
{
|
||||
Application.DoEvents();
|
||||
this.Visible = false;
|
||||
MessageBox.Show("데이터베이스 접속정보가 존재하지 않습니다\n개발부서에 접속정보를 문의하세요", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Pub.dbinfo = DatabaseConnectionString.Utility.ShowForm();
|
||||
if (Pub.dbinfo.IsValid == false)
|
||||
{
|
||||
MessageBox.Show("데이터 베이스 정보가 없습니다\n프로그램이 정상 작동하지 않을 수 있습니다", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
this.Visible = true;
|
||||
}
|
||||
Properties.Settings.Default["CS"] = Pub.dbinfo.ToString();
|
||||
Properties.Settings.Default["gwcs"] = Pub.dbinfo.ToString();
|
||||
//Util.MsgE(Pub.dbinfo.ToString());
|
||||
//Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D;Encrypt=False;TrustServerCertificate=True
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Pub.barcode = new Device.Barcode();
|
||||
if (!Pub.setting.Barcode.isEmpty()) Pub.barcode.PortName = Pub.setting.Barcode;
|
||||
Pub.barcode.ReceiveData += barcode_ReceiveData;
|
||||
@@ -205,9 +232,9 @@ namespace Project
|
||||
|
||||
void Func_Login()
|
||||
{
|
||||
Dialog.fLogin flogIn = new Dialog.fLogin();
|
||||
if (flogIn.ShowDialog() != System.Windows.Forms.DialogResult.OK)
|
||||
Application.ExitThread();
|
||||
using (Dialog.fLogin flogIn = new Dialog.fLogin())
|
||||
if (flogIn.ShowDialog() != System.Windows.Forms.DialogResult.OK)
|
||||
Application.ExitThread();
|
||||
|
||||
this.mn_purchase.Visible = FCOMMON.Util.getBit(FCOMMON.info.Login.gpermission, (int)FCOMMON.eGroupPermission.menu_purchase);
|
||||
this.mn_project.Visible = FCOMMON.Util.getBit(FCOMMON.info.Login.gpermission, (int)FCOMMON.eGroupPermission.menu_project);
|
||||
@@ -232,7 +259,7 @@ namespace Project
|
||||
FCOMMON.info.Login.gcode);
|
||||
Pub.log.Add("Program Start");
|
||||
|
||||
sbLoginUseTime.Text = "접속시간:"+FCOMMON.info.Login.loginusetime.ToString("N1") + "ms";
|
||||
sbLoginUseTime.Text = "접속시간:" + FCOMMON.info.Login.loginusetime.ToString("N1") + "ms";
|
||||
|
||||
Func_RunStartForm();
|
||||
}
|
||||
@@ -507,7 +534,7 @@ namespace Project
|
||||
// FCOMMON.Util.MsgE("SPR구매현황은 신규 개발 기능으로 아직 open 되지 않았습니다");
|
||||
// return;
|
||||
//}
|
||||
|
||||
|
||||
string formkey = "PUCHASEEB";
|
||||
if (!ShowForm(formkey))
|
||||
AddForm(formkey, new FEQ0000.fPurchaseEB(), "해외지원+전자실 구매");
|
||||
@@ -962,7 +989,7 @@ namespace Project
|
||||
menu_work_report();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void 근태입력ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -985,8 +1012,8 @@ namespace Project
|
||||
{
|
||||
menu_projecT_list();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void toolStripButton2_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
@@ -1022,7 +1049,7 @@ namespace Project
|
||||
//f.Show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void layoutToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
string formkey = "PLYOU";
|
||||
@@ -1354,12 +1381,12 @@ namespace Project
|
||||
var itemsid = dar["sid"].ToString().Trim();
|
||||
var itemgcode = dar["gcode"].ToString().Trim();
|
||||
|
||||
if(cnt1 % 50 == 0) Application.DoEvents();
|
||||
if (cnt1 % 50 == 0) Application.DoEvents();
|
||||
|
||||
//해당uidname 을 프로젝트 정보에서 찾는다.
|
||||
cmdupdate.CommandText = $"select max(idx) from Items where gcode = '{itemgcode}' and [sid] = '{itemsid}' and isnull(disable,0) = 0";
|
||||
cmdupdate.Parameters.Clear();
|
||||
|
||||
|
||||
|
||||
var obj_pumidx = cmdupdate.ExecuteScalar();
|
||||
if (obj_pumidx == null) continue;
|
||||
@@ -1389,7 +1416,7 @@ namespace Project
|
||||
if (cnt == 1) Console.WriteLine($"[{rec}] update {cnt} {itemsid} -> {str_pumidx}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1411,7 +1438,7 @@ namespace Project
|
||||
private void 품목입고ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
menu_itemin();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void 담당자별현황ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@@ -1491,7 +1518,7 @@ namespace Project
|
||||
|
||||
private void 업무분류및형태설정ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var f = new FPJ0000.JobReport_.fJobProcessSelect("",true);
|
||||
var f = new FPJ0000.JobReport_.fJobProcessSelect("", true);
|
||||
f.Show();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class vFindSID
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public string Location { get; set; }
|
||||
public string date { get; set; }
|
||||
public string gcode { get; set; }
|
||||
public string name { get; set; }
|
||||
public string sid { get; set; }
|
||||
public string model { get; set; }
|
||||
public string manu { get; set; }
|
||||
public string unit { get; set; }
|
||||
public string supply { get; set; }
|
||||
public Nullable<decimal> price { get; set; }
|
||||
public string remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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; }
|
||||
public string state { get; set; }
|
||||
public Nullable<bool> useJobReport { get; set; }
|
||||
public Nullable<bool> useUserState { get; set; }
|
||||
public string password { get; set; }
|
||||
public Nullable<bool> exceptHoly { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class vJobReportForUser
|
||||
{
|
||||
public int idx { get; set; }
|
||||
public string pdate { get; set; }
|
||||
public string gcode { get; set; }
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string process { get; set; }
|
||||
public string type { get; set; }
|
||||
public string svalue { get; set; }
|
||||
public Nullable<double> hrs { get; set; }
|
||||
public Nullable<double> ot { get; set; }
|
||||
public string requestpart { get; set; }
|
||||
public string package { get; set; }
|
||||
public string userProcess { get; set; }
|
||||
public string status { get; set; }
|
||||
public string projectName { get; set; }
|
||||
public string description { get; set; }
|
||||
public string ww { get; set; }
|
||||
public Nullable<System.DateTime> otStart { get; set; }
|
||||
public Nullable<System.DateTime> otEnd { get; set; }
|
||||
public Nullable<double> ot2 { get; set; }
|
||||
public string otReason { get; set; }
|
||||
public string grade { get; set; }
|
||||
public string indate { get; set; }
|
||||
public string outdate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 템플릿에서 생성되었습니다.
|
||||
//
|
||||
// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
|
||||
// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Project
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class vPurchase
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int idx { get; set; }
|
||||
public string gcode { get; set; }
|
||||
public string pdate { get; set; }
|
||||
public string state { get; set; }
|
||||
public string process { get; set; }
|
||||
public string receive { get; set; }
|
||||
public string sc { get; set; }
|
||||
public string request { get; set; }
|
||||
public string sid { get; set; }
|
||||
public string pumname { get; set; }
|
||||
public Nullable<int> pumidx { get; set; }
|
||||
public string pumscale { get; set; }
|
||||
public string pumunit { get; set; }
|
||||
public Nullable<int> pumqty { get; set; }
|
||||
public Nullable<decimal> pumprice { get; set; }
|
||||
public Nullable<decimal> pumpriceD { get; set; }
|
||||
public Nullable<decimal> pumamt { get; set; }
|
||||
public string supply { get; set; }
|
||||
public Nullable<int> supplyidx { get; set; }
|
||||
public string project { get; set; }
|
||||
public Nullable<int> projectidx { get; set; }
|
||||
public string asset { get; set; }
|
||||
public string manuproc { get; set; }
|
||||
public string edate { get; set; }
|
||||
public string indate { get; set; }
|
||||
public string po { get; set; }
|
||||
public string dept { get; set; }
|
||||
public string bigo { get; set; }
|
||||
public Nullable<bool> import { get; set; }
|
||||
public Nullable<bool> isdel { get; set; }
|
||||
public string orderno { get; set; }
|
||||
public string place { get; set; }
|
||||
public string wuid { get; set; }
|
||||
public System.DateTime wdate { get; set; }
|
||||
public Nullable<int> inqty { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user