Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c9e3374d5d |
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Note: Add entries to the App.config file for configuration settings
|
||||
that apply only to the Test project.
|
||||
@@ -11,4 +11,24 @@
|
||||
<connectionStrings>
|
||||
|
||||
</connectionStrings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Currency
|
||||
{
|
||||
public Currency()
|
||||
{
|
||||
this.PricePoint = new HashSet<PricePoint>();
|
||||
this.CurrencyImage = new HashSet<CurrencyImage>();
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string Info { get; set; }
|
||||
|
||||
public virtual CurrencyCategory CurrencyCategory { get; set; }
|
||||
public virtual ICollection<PricePoint> PricePoint { get; set; }
|
||||
public virtual ICollection<CurrencyImage> CurrencyImage { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class CurrencyCategory
|
||||
{
|
||||
public CurrencyCategory()
|
||||
{
|
||||
this.Currencies = new HashSet<Currency>();
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Type { get; set; }
|
||||
|
||||
public virtual ICollection<Currency> Currencies { get; set; }
|
||||
public virtual CurrencyCategoryImage CurrencyCategoryImage { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class CurrencyCategoryImage
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ImageURL { get; set; }
|
||||
public byte[] Image { get; set; }
|
||||
public string Author { get; set; }
|
||||
|
||||
public virtual CurrencyCategory CurrencyCategories { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class CurrencyImage
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ImageURL { get; set; }
|
||||
public byte[] Image { get; set; }
|
||||
public string Author { get; set; }
|
||||
|
||||
public virtual Currency Currencies { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Deal
|
||||
{
|
||||
public Deal()
|
||||
{
|
||||
this.DealItems = new HashSet<DealItem>();
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Info { get; set; }
|
||||
public System.DateTime DateBegin { get; set; }
|
||||
public Nullable<System.DateTime> DateEnd { get; set; }
|
||||
|
||||
public virtual ICollection<DealItem> DealItems { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class DealItem
|
||||
{
|
||||
public DealItem()
|
||||
{
|
||||
this.Items = new HashSet<Item>();
|
||||
this.PricePoints = new HashSet<PricePoint>();
|
||||
this.ItemCategories = new HashSet<ItemCategory>();
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public virtual Deal Deal { get; set; }
|
||||
public virtual ICollection<Item> Items { get; set; }
|
||||
public virtual PriceCategory PriceCategory { get; set; }
|
||||
public virtual ICollection<PricePoint> PricePoints { get; set; }
|
||||
public virtual ICollection<ItemCategory> ItemCategories { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Item
|
||||
{
|
||||
public Item()
|
||||
{
|
||||
this.ItemImages = new HashSet<ItemImage>();
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Info { get; set; }
|
||||
|
||||
public virtual ItemCategory ItemCategory { get; set; }
|
||||
public virtual PriceCategory PriceCategory { get; set; }
|
||||
public virtual DealItem DealItem { get; set; }
|
||||
public virtual ICollection<ItemImage> ItemImages { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class ItemCategory
|
||||
{
|
||||
public ItemCategory()
|
||||
{
|
||||
this.Items = new HashSet<Item>();
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Info { get; set; }
|
||||
public Tangibility Tangibility { get; set; }
|
||||
|
||||
public virtual ICollection<Item> Items { get; set; }
|
||||
public virtual DealItem DealItem { get; set; }
|
||||
public virtual ItemCategoryImage ItemCategoryImage { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class ItemCategoryImage
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ImageURL { get; set; }
|
||||
public byte[] Image { get; set; }
|
||||
public string Author { get; set; }
|
||||
|
||||
public virtual ItemCategory ItemCategories { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class ItemImage
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ImageURL { get; set; }
|
||||
public string Image { get; set; }
|
||||
public string Author { get; set; }
|
||||
|
||||
public virtual Item Items { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
public partial class ItemContainer : DbContext
|
||||
{
|
||||
public ItemContainer()
|
||||
: base("name=ItemContainer")
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
throw new UnintentionalCodeFirstException();
|
||||
}
|
||||
|
||||
public DbSet<Item> Items { get; set; }
|
||||
public DbSet<ItemCategory> ItemCategories { get; set; }
|
||||
public DbSet<PriceCategory> PriceCategories { get; set; }
|
||||
public DbSet<PricePoint> PricePoints { get; set; }
|
||||
public DbSet<Deal> Deals { get; set; }
|
||||
public DbSet<DealItem> DealItems { get; set; }
|
||||
public DbSet<ItemImage> ItemImages { get; set; }
|
||||
public DbSet<Currency> Currencies { get; set; }
|
||||
public DbSet<CurrencyCategory> CurrencyCategories { get; set; }
|
||||
public DbSet<ItemCategoryImage> ItemCategoryImages { get; set; }
|
||||
public DbSet<CurrencyImage> CurrencyImages { get; set; }
|
||||
public DbSet<CurrencyCategoryImage> CurrencyCategoryImages { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,735 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"Models.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>
|
||||
// <#=GetResourceString("Template_GeneratedCodeCommentLine1")#>
|
||||
//
|
||||
// <#=GetResourceString("Template_GeneratedCodeCommentLine2")#>
|
||||
// <#=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.Objects;
|
||||
using System.Data.Objects.DataClasses;
|
||||
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;
|
||||
<#
|
||||
}
|
||||
#>
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
#>
|
||||
|
||||
[EdmFunction("<#=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_EF5";
|
||||
|
||||
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 navigationProperty)
|
||||
{
|
||||
var endType = _typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType());
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2} {{ {3}get; {4}set; }}",
|
||||
AccessibilityAndVirtual(Accessibility.ForProperty(navigationProperty)),
|
||||
navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
|
||||
_code.Escape(navigationProperty),
|
||||
_code.SpaceAfter(Accessibility.ForGetter(navigationProperty)),
|
||||
_code.SpaceAfter(Accessibility.ForSetter(navigationProperty)));
|
||||
}
|
||||
|
||||
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(" + 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 => 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 => 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} 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 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);
|
||||
}
|
||||
|
||||
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, 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 class EdmMetadataLoader
|
||||
{
|
||||
private readonly IDynamicHost _host;
|
||||
private readonly System.Collections.IList _errors;
|
||||
|
||||
public EdmMetadataLoader(IDynamicHost host, System.Collections.IList errors)
|
||||
{
|
||||
ArgumentNotNull(host, "host");
|
||||
ArgumentNotNull(errors, "errors");
|
||||
|
||||
_host = host;
|
||||
_errors = errors;
|
||||
}
|
||||
|
||||
public IEnumerable<GlobalItem> CreateEdmItemCollection(string sourcePath)
|
||||
{
|
||||
ArgumentNotNull(sourcePath, "sourcePath");
|
||||
|
||||
if (!ValidateInputPath(sourcePath))
|
||||
{
|
||||
return new EdmItemCollection();
|
||||
}
|
||||
|
||||
var schemaElement = LoadRootElement(_host.ResolvePath(sourcePath));
|
||||
if (schemaElement != null)
|
||||
{
|
||||
using (var reader = schemaElement.CreateReader())
|
||||
{
|
||||
IList<EdmSchemaError> errors;
|
||||
var itemCollection = MetadataItemCollectionFactory.CreateEdmItemCollection(new[] { reader }, out errors);
|
||||
|
||||
ProcessErrors(errors, sourcePath);
|
||||
|
||||
return itemCollection;
|
||||
}
|
||||
}
|
||||
return new EdmItemCollection();
|
||||
}
|
||||
|
||||
public string GetModelNamespace(string sourcePath)
|
||||
{
|
||||
ArgumentNotNull(sourcePath, "sourcePath");
|
||||
|
||||
if (!ValidateInputPath(sourcePath))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var model = LoadRootElement(_host.ResolvePath(sourcePath));
|
||||
if (model == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var attribute = model.Attribute("Namespace");
|
||||
return attribute != null ? attribute.Value : "";
|
||||
}
|
||||
|
||||
private bool ValidateInputPath(string sourcePath)
|
||||
{
|
||||
if (sourcePath == "$" + "edmxInputFile" + "$")
|
||||
{
|
||||
_errors.Add(
|
||||
new CompilerError(_host.TemplateFile ?? sourcePath, 0, 0, string.Empty,
|
||||
GetResourceString("Template_ReplaceVsItemTemplateToken")));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public XElement LoadRootElement(string sourcePath)
|
||||
{
|
||||
ArgumentNotNull(sourcePath, "sourcePath");
|
||||
|
||||
var root = XElement.Load(sourcePath, LoadOptions.SetBaseUri | LoadOptions.SetLineInfo);
|
||||
return root.Elements()
|
||||
.Where(e => e.Name.LocalName == "Runtime")
|
||||
.Elements()
|
||||
.Where(e => e.Name.LocalName == "ConceptualModels")
|
||||
.Elements()
|
||||
.Where(e => e.Name.LocalName == "Schema")
|
||||
.FirstOrDefault()
|
||||
?? root;
|
||||
}
|
||||
|
||||
private void ProcessErrors(IEnumerable<EdmSchemaError> errors, string sourceFilePath)
|
||||
{
|
||||
foreach (var error in errors)
|
||||
{
|
||||
_errors.Add(
|
||||
new CompilerError(
|
||||
error.SchemaLocation ?? sourceFilePath,
|
||||
error.Line,
|
||||
error.Column,
|
||||
error.ErrorCode.ToString(CultureInfo.InvariantCulture),
|
||||
error.Message)
|
||||
{
|
||||
IsWarning = error.Severity == EdmSchemaErrorSeverity.Warning
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsLazyLoadingEnabled(EntityContainer container)
|
||||
{
|
||||
string lazyLoadingAttributeValue;
|
||||
var lazyLoadingAttributeName = MetadataConstants.EDM_ANNOTATION_09_02 + ":LazyLoadingEnabled";
|
||||
bool isLazyLoading;
|
||||
return !MetadataTools.TryGetStringMetadataPropertySetting(container, lazyLoadingAttributeName, out lazyLoadingAttributeValue)
|
||||
|| !bool.TryParse(lazyLoadingAttributeValue, out isLazyLoading)
|
||||
|| isLazyLoading;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ArgumentNotNull<T>(T arg, string name) where T : class
|
||||
{
|
||||
if (arg == null)
|
||||
{
|
||||
throw new ArgumentNullException(name);
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Lazy<System.Resources.ResourceManager> ResourceManager =
|
||||
new Lazy<System.Resources.ResourceManager>(
|
||||
() => new System.Resources.ResourceManager("System.Data.Entity.Design", typeof(MetadataItemCollectionFactory).Assembly), isThreadSafe: true);
|
||||
|
||||
public static string GetResourceString(string resourceName)
|
||||
{
|
||||
ArgumentNotNull(resourceName, "resourceName");
|
||||
|
||||
return ResourceManager.Value.GetString(resourceName, null);
|
||||
}
|
||||
|
||||
#>
|
||||
Generated
+10
@@ -0,0 +1,10 @@
|
||||
// T4 code generation is enabled for model 'D:\@Dev\_\_Repo.ASPnix\simple-shop\Simple-Shop\Models\Models.edmx'.
|
||||
// To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
|
||||
// property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
|
||||
// is open in the designer.
|
||||
|
||||
// If no context and entity classes have been generated, it may be because you created an empty model but
|
||||
// have not yet chosen which version of Entity Framework to use. To generate a context class and entity
|
||||
// classes for your model, open the model in the designer, right-click on the designer surface, and
|
||||
// select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation
|
||||
// Item...'.
|
||||
@@ -0,0 +1,9 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
<?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 xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl" Namespace="Item.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005">
|
||||
<EntityContainer Name="ItemTargetContainer" >
|
||||
</EntityContainer>
|
||||
</Schema>
|
||||
</edmx:StorageModels>
|
||||
<!-- CSDL content -->
|
||||
<edmx:ConceptualModels>
|
||||
<Schema xmlns="http://schemas.microsoft.com/ado/2009/11/edm" xmlns:cg="http://schemas.microsoft.com/ado/2006/04/codegeneration" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" Namespace="Item" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" annotation:UseStrongSpatialTypes="false">
|
||||
<EntityContainer Name="ItemContainer" annotation:LazyLoadingEnabled="true">
|
||||
<EntitySet Name="Items" EntityType="Item.Item" />
|
||||
<EntitySet Name="ItemCategories" EntityType="Item.ItemCategory" />
|
||||
<EntitySet Name="PriceCategories" EntityType="Item.PriceCategory" />
|
||||
<EntitySet Name="PricePoints" EntityType="Item.PricePoint" />
|
||||
<AssociationSet Name="ItemCategoryItem" Association="Item.ItemCategoryItem">
|
||||
<End Role="ItemCategory" EntitySet="ItemCategories" />
|
||||
<End Role="Item" EntitySet="Items" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="PriceCategoryItem" Association="Item.PriceCategoryItem">
|
||||
<End Role="PriceCategory" EntitySet="PriceCategories" />
|
||||
<End Role="Item" EntitySet="Items" />
|
||||
</AssociationSet>
|
||||
<EntitySet Name="Deals" EntityType="Item.Deal" />
|
||||
<EntitySet Name="DealItems" EntityType="Item.DealItem" />
|
||||
<AssociationSet Name="DealsDealItems" Association="Item.DealsDealItems">
|
||||
<End Role="Deals" EntitySet="Deals" />
|
||||
<End Role="DealItems" EntitySet="DealItems" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="DealItemsItems" Association="Item.DealItemsItems">
|
||||
<End Role="DealItems" EntitySet="DealItems" />
|
||||
<End Role="Items" EntitySet="Items" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="DealItemsPriceCategories" Association="Item.DealItemsPriceCategories">
|
||||
<End Role="DealItems" EntitySet="DealItems" />
|
||||
<End Role="PriceCategories" EntitySet="PriceCategories" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="DealItemsPricePoints" Association="Item.DealItemsPricePoints">
|
||||
<End Role="DealItems" EntitySet="DealItems" />
|
||||
<End Role="PricePoints" EntitySet="PricePoints" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="PriceCategoriesPricePoints" Association="Item.PriceCategoriesPricePoints">
|
||||
<End Role="PriceCategories" EntitySet="PriceCategories" />
|
||||
<End Role="PricePoints" EntitySet="PricePoints" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="DealItemsItemCategories" Association="Item.DealItemsItemCategories">
|
||||
<End Role="DealItems" EntitySet="DealItems" />
|
||||
<End Role="ItemCategories" EntitySet="ItemCategories" />
|
||||
</AssociationSet>
|
||||
<EntitySet Name="ItemImages" EntityType="Item.ItemImage" />
|
||||
<AssociationSet Name="ImagesItems" Association="Item.ImagesItems">
|
||||
<End Role="Images" EntitySet="ItemImages" />
|
||||
<End Role="Items" EntitySet="Items" />
|
||||
</AssociationSet>
|
||||
<EntitySet Name="Currencies" EntityType="Item.Currency" />
|
||||
<EntitySet Name="CurrencyCategories" EntityType="Item.CurrencyCategory" />
|
||||
<AssociationSet Name="CurrencyCategoryCurrencies" Association="Item.CurrencyCategoryCurrencies">
|
||||
<End Role="CurrencyCategory" EntitySet="CurrencyCategories" />
|
||||
<End Role="Currencies" EntitySet="Currencies" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="PricePointsCurrencies" Association="Item.PricePointsCurrencies">
|
||||
<End Role="PricePoints" EntitySet="PricePoints" />
|
||||
<End Role="Currencies" EntitySet="Currencies" />
|
||||
</AssociationSet>
|
||||
<EntitySet Name="ItemCategoryImages" EntityType="Item.ItemCategoryImage" />
|
||||
<AssociationSet Name="ItemCategoryImageItemCategory" Association="Item.ItemCategoryImageItemCategory">
|
||||
<End Role="ItemCategoryImage" EntitySet="ItemCategoryImages" />
|
||||
<End Role="ItemCategory" EntitySet="ItemCategories" />
|
||||
</AssociationSet>
|
||||
<EntitySet Name="CurrencyImages" EntityType="Item.CurrencyImage" />
|
||||
<EntitySet Name="CurrencyCategoryImages" EntityType="Item.CurrencyCategoryImage" />
|
||||
<AssociationSet Name="CurrencyCategoryImageCurrencyCategory" Association="Item.CurrencyCategoryImageCurrencyCategory">
|
||||
<End Role="CurrencyCategoryImage" EntitySet="CurrencyCategoryImages" />
|
||||
<End Role="CurrencyCategory" EntitySet="CurrencyCategories" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="CurrencyImageCurrency" Association="Item.CurrencyImageCurrency">
|
||||
<End Role="CurrencyImage" EntitySet="CurrencyImages" />
|
||||
<End Role="Currency" EntitySet="Currencies" />
|
||||
</AssociationSet>
|
||||
</EntityContainer>
|
||||
<EntityType Name="Item">
|
||||
<Key>
|
||||
<PropertyRef Name="Id" />
|
||||
</Key>
|
||||
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="Name" Type="String" Nullable="false" />
|
||||
<NavigationProperty Name="ItemCategory" Relationship="Item.ItemCategoryItem" FromRole="Item" ToRole="ItemCategory" />
|
||||
<NavigationProperty Name="PriceCategory" Relationship="Item.PriceCategoryItem" FromRole="Item" ToRole="PriceCategory" />
|
||||
<NavigationProperty Name="DealItem" Relationship="Item.DealItemsItems" FromRole="Items" ToRole="DealItems" />
|
||||
<Property Name="Info" Type="String" Nullable="true" />
|
||||
<NavigationProperty Name="ItemImages" Relationship="Item.ImagesItems" FromRole="Items" ToRole="Images" />
|
||||
</EntityType>
|
||||
<EntityType Name="ItemCategory">
|
||||
<Key>
|
||||
<PropertyRef Name="Id" />
|
||||
</Key>
|
||||
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<NavigationProperty Name="Items" Relationship="Item.ItemCategoryItem" FromRole="ItemCategory" ToRole="Item" />
|
||||
<Property Name="Name" Type="String" Nullable="false" />
|
||||
<Property Name="Info" Type="String" Nullable="true" />
|
||||
<NavigationProperty Name="DealItem" Relationship="Item.DealItemsItemCategories" FromRole="ItemCategories" ToRole="DealItems" />
|
||||
<Property Name="Tangibility" Type="Item.Tangibility" Nullable="false" />
|
||||
<NavigationProperty Name="ItemCategoryImage" Relationship="Item.ItemCategoryImageItemCategory" FromRole="ItemCategory" ToRole="ItemCategoryImage" />
|
||||
</EntityType>
|
||||
<EntityType Name="PriceCategory">
|
||||
<Key>
|
||||
<PropertyRef Name="Id" />
|
||||
</Key>
|
||||
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<NavigationProperty Name="Items" Relationship="Item.PriceCategoryItem" FromRole="PriceCategory" ToRole="Item" />
|
||||
<NavigationProperty Name="DealItem" Relationship="Item.DealItemsPriceCategories" FromRole="PriceCategories" ToRole="DealItems" />
|
||||
<NavigationProperty Name="PricePoints" Relationship="Item.PriceCategoriesPricePoints" FromRole="PriceCategories" ToRole="PricePoints" />
|
||||
<Property Name="Name" Type="String" Nullable="false" />
|
||||
<Property Name="Info" Type="String" Nullable="true" />
|
||||
</EntityType>
|
||||
<EntityType Name="PricePoint">
|
||||
<Key>
|
||||
<PropertyRef Name="Id" />
|
||||
</Key>
|
||||
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<NavigationProperty Name="DealItem" Relationship="Item.DealItemsPricePoints" FromRole="PricePoints" ToRole="DealItems" />
|
||||
<NavigationProperty Name="PriceCategory" Relationship="Item.PriceCategoriesPricePoints" FromRole="PricePoints" ToRole="PriceCategories" />
|
||||
<Property Name="Qty" Type="Double" Nullable="false" />
|
||||
<NavigationProperty Name="Currency" Relationship="Item.PricePointsCurrencies" FromRole="PricePoints" ToRole="Currencies" />
|
||||
</EntityType>
|
||||
<Association Name="ItemCategoryItem">
|
||||
<End Type="Item.ItemCategory" Role="ItemCategory" Multiplicity="1" />
|
||||
<End Type="Item.Item" Role="Item" Multiplicity="*" />
|
||||
</Association>
|
||||
<Association Name="PriceCategoryItem">
|
||||
<End Type="Item.PriceCategory" Role="PriceCategory" Multiplicity="1" />
|
||||
<End Type="Item.Item" Role="Item" Multiplicity="*" />
|
||||
</Association>
|
||||
<EntityType Name="Deal">
|
||||
<Key>
|
||||
<PropertyRef Name="Id" />
|
||||
</Key>
|
||||
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="Name" Type="String" Nullable="false" />
|
||||
<Property Name="Info" Type="String" Nullable="false" />
|
||||
<Property Name="DateBegin" Type="DateTime" Nullable="false" />
|
||||
<Property Name="DateEnd" Type="DateTime" Nullable="true" annotation:StoreGeneratedPattern="None" />
|
||||
<NavigationProperty Name="DealItems" Relationship="Item.DealsDealItems" FromRole="Deals" ToRole="DealItems" />
|
||||
</EntityType>
|
||||
<EntityType Name="DealItem">
|
||||
<Key>
|
||||
<PropertyRef Name="Id" />
|
||||
</Key>
|
||||
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<NavigationProperty Name="Deal" Relationship="Item.DealsDealItems" FromRole="DealItems" ToRole="Deals" />
|
||||
<NavigationProperty Name="Items" Relationship="Item.DealItemsItems" FromRole="DealItems" ToRole="Items" />
|
||||
<NavigationProperty Name="PriceCategory" Relationship="Item.DealItemsPriceCategories" FromRole="DealItems" ToRole="PriceCategories" />
|
||||
<NavigationProperty Name="PricePoints" Relationship="Item.DealItemsPricePoints" FromRole="DealItems" ToRole="PricePoints" />
|
||||
<NavigationProperty Name="ItemCategories" Relationship="Item.DealItemsItemCategories" FromRole="DealItems" ToRole="ItemCategories" />
|
||||
</EntityType>
|
||||
<Association Name="DealsDealItems">
|
||||
<End Type="Item.Deal" Role="Deals" Multiplicity="1" />
|
||||
<End Type="Item.DealItem" Role="DealItems" Multiplicity="*" />
|
||||
</Association>
|
||||
<Association Name="DealItemsItems">
|
||||
<End Type="Item.DealItem" Role="DealItems" Multiplicity="1" />
|
||||
<End Type="Item.Item" Role="Items" Multiplicity="*" />
|
||||
</Association>
|
||||
<Association Name="DealItemsPriceCategories">
|
||||
<End Type="Item.DealItem" Role="DealItems" Multiplicity="*" />
|
||||
<End Type="Item.PriceCategory" Role="PriceCategories" Multiplicity="0..1" />
|
||||
</Association>
|
||||
<Association Name="DealItemsPricePoints">
|
||||
<End Type="Item.DealItem" Role="DealItems" Multiplicity="*" />
|
||||
<End Type="Item.PricePoint" Role="PricePoints" Multiplicity="*" />
|
||||
</Association>
|
||||
<Association Name="PriceCategoriesPricePoints">
|
||||
<End Type="Item.PriceCategory" Role="PriceCategories" Multiplicity="*" />
|
||||
<End Type="Item.PricePoint" Role="PricePoints" Multiplicity="*" />
|
||||
</Association>
|
||||
<Association Name="DealItemsItemCategories">
|
||||
<End Type="Item.DealItem" Role="DealItems" Multiplicity="1" />
|
||||
<End Type="Item.ItemCategory" Role="ItemCategories" Multiplicity="*" />
|
||||
</Association>
|
||||
<EntityType Name="ItemImage">
|
||||
<Key>
|
||||
<PropertyRef Name="Id" />
|
||||
</Key>
|
||||
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="Name" Type="String" Nullable="false" />
|
||||
<Property Name="ImageURL" Type="String" Nullable="true" />
|
||||
<Property Name="Image" Type="String" Nullable="false" />
|
||||
<Property Name="Author" Type="String" Nullable="true" />
|
||||
<NavigationProperty Name="Items" Relationship="Item.ImagesItems" FromRole="Images" ToRole="Items" />
|
||||
</EntityType>
|
||||
<Association Name="ImagesItems">
|
||||
<End Type="Item.ItemImage" Role="Images" Multiplicity="*" />
|
||||
<End Type="Item.Item" Role="Items" Multiplicity="0..1" />
|
||||
</Association>
|
||||
<EntityType Name="Currency">
|
||||
<Key>
|
||||
<PropertyRef Name="Id" />
|
||||
</Key>
|
||||
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="Name" Type="String" Nullable="false" />
|
||||
<Property Name="Type" Type="String" Nullable="false" />
|
||||
<Property Name="Info" Type="String" Nullable="true" />
|
||||
<NavigationProperty Name="CurrencyCategory" Relationship="Item.CurrencyCategoryCurrencies" FromRole="Currencies" ToRole="CurrencyCategory" />
|
||||
<NavigationProperty Name="PricePoint" Relationship="Item.PricePointsCurrencies" FromRole="Currencies" ToRole="PricePoints" />
|
||||
<NavigationProperty Name="CurrencyImage" Relationship="Item.CurrencyImageCurrency" FromRole="Currency" ToRole="CurrencyImage" />
|
||||
</EntityType>
|
||||
<EntityType Name="CurrencyCategory">
|
||||
<Key>
|
||||
<PropertyRef Name="Id" />
|
||||
</Key>
|
||||
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="Name" Type="String" Nullable="false" />
|
||||
<Property Name="Type" Type="String" Nullable="false" />
|
||||
<NavigationProperty Name="Currencies" Relationship="Item.CurrencyCategoryCurrencies" FromRole="CurrencyCategory" ToRole="Currencies" />
|
||||
<NavigationProperty Name="CurrencyCategoryImage" Relationship="Item.CurrencyCategoryImageCurrencyCategory" FromRole="CurrencyCategory" ToRole="CurrencyCategoryImage" />
|
||||
</EntityType>
|
||||
<Association Name="CurrencyCategoryCurrencies">
|
||||
<End Type="Item.CurrencyCategory" Role="CurrencyCategory" Multiplicity="1" />
|
||||
<End Type="Item.Currency" Role="Currencies" Multiplicity="*" />
|
||||
</Association>
|
||||
<Association Name="PricePointsCurrencies">
|
||||
<End Type="Item.PricePoint" Role="PricePoints" Multiplicity="*" />
|
||||
<End Type="Item.Currency" Role="Currencies" Multiplicity="1" />
|
||||
</Association>
|
||||
<EnumType Name="Tangibility">
|
||||
<Member Name="Unknown" Value="1" />
|
||||
<Member Name="Tangible" Value="2" />
|
||||
<Member Name="Intangible" Value="4" />
|
||||
</EnumType>
|
||||
<EntityType Name="ItemCategoryImage">
|
||||
<Key>
|
||||
<PropertyRef Name="Id" />
|
||||
</Key>
|
||||
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="Name" Type="String" Nullable="false" />
|
||||
<Property Name="ImageURL" Type="String" Nullable="true" />
|
||||
<Property Name="Image" Type="Binary" Nullable="true" />
|
||||
<Property Name="Author" Type="String" Nullable="true" />
|
||||
<NavigationProperty Name="ItemCategories" Relationship="Item.ItemCategoryImageItemCategory" FromRole="ItemCategoryImage" ToRole="ItemCategory" />
|
||||
</EntityType>
|
||||
<Association Name="ItemCategoryImageItemCategory">
|
||||
<End Type="Item.ItemCategoryImage" Role="ItemCategoryImage" Multiplicity="0..1" />
|
||||
<End Type="Item.ItemCategory" Role="ItemCategory" Multiplicity="0..1" />
|
||||
</Association>
|
||||
<EntityType Name="CurrencyImage">
|
||||
<Key>
|
||||
<PropertyRef Name="Id" />
|
||||
</Key>
|
||||
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="Name" Type="String" Nullable="false" />
|
||||
<Property Name="ImageURL" Type="String" Nullable="true" />
|
||||
<Property Name="Image" Type="Binary" Nullable="true" />
|
||||
<Property Name="Author" Type="String" Nullable="true" />
|
||||
<NavigationProperty Name="Currencies" Relationship="Item.CurrencyImageCurrency" FromRole="CurrencyImage" ToRole="Currency" />
|
||||
</EntityType>
|
||||
<EntityType Name="CurrencyCategoryImage">
|
||||
<Key>
|
||||
<PropertyRef Name="Id" />
|
||||
</Key>
|
||||
<Property Name="Id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="Name" Type="String" Nullable="false" />
|
||||
<Property Name="ImageURL" Type="String" Nullable="true" />
|
||||
<Property Name="Image" Type="Binary" Nullable="true" />
|
||||
<Property Name="Author" Type="String" Nullable="true" />
|
||||
<NavigationProperty Name="CurrencyCategories" Relationship="Item.CurrencyCategoryImageCurrencyCategory" FromRole="CurrencyCategoryImage" ToRole="CurrencyCategory" />
|
||||
</EntityType>
|
||||
<Association Name="CurrencyCategoryImageCurrencyCategory">
|
||||
<End Type="Item.CurrencyCategoryImage" Role="CurrencyCategoryImage" Multiplicity="0..1" />
|
||||
<End Type="Item.CurrencyCategory" Role="CurrencyCategory" Multiplicity="0..1" />
|
||||
</Association>
|
||||
<Association Name="CurrencyImageCurrency">
|
||||
<End Type="Item.CurrencyImage" Role="CurrencyImage" Multiplicity="*" />
|
||||
<End Type="Item.Currency" Role="Currency" Multiplicity="0..1" />
|
||||
</Association>
|
||||
</Schema>
|
||||
</edmx:ConceptualModels>
|
||||
<!-- C-S mapping content -->
|
||||
<edmx:Mappings>
|
||||
<Mapping xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs" Space="C-S">
|
||||
<Alias Key="Model" Value="Item" />
|
||||
<Alias Key="Target" Value="Item.Store" />
|
||||
<EntityContainerMapping CdmEntityContainer="ItemContainer" StorageEntityContainer="ItemTargetContainer">
|
||||
</EntityContainerMapping>
|
||||
</Mapping>
|
||||
</edmx:Mappings>
|
||||
</edmx:Runtime>
|
||||
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
|
||||
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<edmx:Connection>
|
||||
<DesignerInfoPropertySet>
|
||||
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
|
||||
</DesignerInfoPropertySet>
|
||||
</edmx:Connection>
|
||||
<edmx:Options>
|
||||
<DesignerInfoPropertySet>
|
||||
<DesignerProperty Name="ValidateOnBuild" Value="true" />
|
||||
<DesignerProperty Name="EnablePluralization" Value="True" />
|
||||
<DesignerProperty Name="CodeGenerationStrategy" Value="None" />
|
||||
</DesignerInfoPropertySet>
|
||||
</edmx:Options>
|
||||
<!-- Diagram content (shape and connector positions) -->
|
||||
<edmx:Diagrams>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
</edmx:Edmx>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?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="fb05f6bccace4680b13575be0003b40b" Name="Diagram1" >
|
||||
<EntityTypeShape EntityType="Item.Item" Width="1.5" PointX="2.625" PointY="4.375" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="Item.ItemCategory" Width="1.5" PointX="0.5" PointY="4.25" />
|
||||
<EntityTypeShape EntityType="Item.PriceCategory" Width="1.5" PointX="4.625" PointY="4.5" />
|
||||
<EntityTypeShape EntityType="Item.PricePoint" Width="1.5" PointX="5.5" PointY="1.25" />
|
||||
<AssociationConnector Association="Item.ItemCategoryItem" />
|
||||
<AssociationConnector Association="Item.PriceCategoryItem" />
|
||||
<EntityTypeShape EntityType="Item.Deal" Width="1.5" PointX="0.5" PointY="1.125" />
|
||||
<EntityTypeShape EntityType="Item.DealItem" Width="1.5" PointX="2.625" PointY="1.125" />
|
||||
<AssociationConnector Association="Item.DealsDealItems" />
|
||||
<AssociationConnector Association="Item.DealItemsItems" />
|
||||
<AssociationConnector Association="Item.DealItemsPriceCategories" />
|
||||
<AssociationConnector Association="Item.DealItemsPricePoints" />
|
||||
<AssociationConnector Association="Item.PriceCategoriesPricePoints" />
|
||||
<AssociationConnector Association="Item.DealItemsItemCategories" ManuallyRouted="true" >
|
||||
<ConnectorPoint PointX="2.625" PointY="2.7716334987331077" />
|
||||
<ConnectorPoint PointX="2.325" PointY="2.7716334987331077" />
|
||||
<ConnectorPoint PointX="2.325" PointY="4.8537673218048036" />
|
||||
<ConnectorPoint PointX="2" PointY="4.8537673218048036" />
|
||||
</AssociationConnector>
|
||||
<EntityTypeShape EntityType="Item.ItemImage" Width="1.5" PointX="0.625" PointY="7.125" />
|
||||
<AssociationConnector Association="Item.ImagesItems" />
|
||||
<EntityTypeShape EntityType="Item.Currency" Width="1.5" PointX="7.5" PointY="1.25" />
|
||||
<EntityTypeShape EntityType="Item.CurrencyCategory" Width="1.75" PointX="6.5" PointY="4.5" />
|
||||
<AssociationConnector Association="Item.CurrencyCategoryCurrencies" />
|
||||
<AssociationConnector Association="Item.PricePointsCurrencies" />
|
||||
<EntityTypeShape EntityType="Item.ItemCategoryImage" Width="1.875" PointX="2.625" PointY="7.375" />
|
||||
<AssociationConnector Association="Item.ItemCategoryImageItemCategory" ManuallyRouted="false" >
|
||||
</AssociationConnector>
|
||||
<EntityTypeShape EntityType="Item.CurrencyImage" Width="1.5" PointX="8.5" PointY="4.5" />
|
||||
<EntityTypeShape EntityType="Item.CurrencyCategoryImage" Width="2" PointX="6.5" PointY="7.25" />
|
||||
<AssociationConnector Association="Item.CurrencyCategoryImageCurrencyCategory" />
|
||||
<AssociationConnector Association="Item.CurrencyImageCurrency" />
|
||||
</Diagram>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
</edmx:Edmx>
|
||||
@@ -0,0 +1,483 @@
|
||||
|
||||
-- --------------------------------------------------
|
||||
-- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
|
||||
-- --------------------------------------------------
|
||||
-- Date Created: 11/12/2019 19:03:35
|
||||
-- Generated from EDMX file: D:\@Dev\_\_Repo.ASPnix\simple-shop\Simple-Shop\Models\Models.edmx
|
||||
-- --------------------------------------------------
|
||||
|
||||
SET QUOTED_IDENTIFIER OFF;
|
||||
GO
|
||||
USE [simple-shop-0];
|
||||
GO
|
||||
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
|
||||
GO
|
||||
|
||||
-- --------------------------------------------------
|
||||
-- Dropping existing FOREIGN KEY constraints
|
||||
-- --------------------------------------------------
|
||||
|
||||
|
||||
-- --------------------------------------------------
|
||||
-- Dropping existing tables
|
||||
-- --------------------------------------------------
|
||||
|
||||
|
||||
-- --------------------------------------------------
|
||||
-- Creating all tables
|
||||
-- --------------------------------------------------
|
||||
|
||||
-- Creating table 'Items'
|
||||
CREATE TABLE [dbo].[Items] (
|
||||
[Id] int IDENTITY(1,1) NOT NULL,
|
||||
[Name] nvarchar(max) NOT NULL,
|
||||
[Info] nvarchar(max) NULL,
|
||||
[ItemCategory_Id] int NOT NULL,
|
||||
[PriceCategory_Id] int NOT NULL,
|
||||
[DealItem_Id] int NOT NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- Creating table 'ItemCategories'
|
||||
CREATE TABLE [dbo].[ItemCategories] (
|
||||
[Id] int IDENTITY(1,1) NOT NULL,
|
||||
[Name] nvarchar(max) NOT NULL,
|
||||
[Info] nvarchar(max) NULL,
|
||||
[Tangibility] int NOT NULL,
|
||||
[DealItem_Id] int NOT NULL,
|
||||
[ItemCategoryImage_Id] int NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- Creating table 'PriceCategories'
|
||||
CREATE TABLE [dbo].[PriceCategories] (
|
||||
[Id] int IDENTITY(1,1) NOT NULL,
|
||||
[Name] nvarchar(max) NOT NULL,
|
||||
[Info] nvarchar(max) NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- Creating table 'PricePoints'
|
||||
CREATE TABLE [dbo].[PricePoints] (
|
||||
[Id] int IDENTITY(1,1) NOT NULL,
|
||||
[Qty] float NOT NULL,
|
||||
[Currency_Id] int NOT NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- Creating table 'Deals'
|
||||
CREATE TABLE [dbo].[Deals] (
|
||||
[Id] int IDENTITY(1,1) NOT NULL,
|
||||
[Name] nvarchar(max) NOT NULL,
|
||||
[Info] nvarchar(max) NOT NULL,
|
||||
[DateBegin] datetime NOT NULL,
|
||||
[DateEnd] datetime NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- Creating table 'DealItems'
|
||||
CREATE TABLE [dbo].[DealItems] (
|
||||
[Id] int IDENTITY(1,1) NOT NULL,
|
||||
[Deal_Id] int NOT NULL,
|
||||
[PriceCategory_Id] int NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- Creating table 'ItemImages'
|
||||
CREATE TABLE [dbo].[ItemImages] (
|
||||
[Id] int IDENTITY(1,1) NOT NULL,
|
||||
[Name] nvarchar(max) NOT NULL,
|
||||
[ImageURL] nvarchar(max) NULL,
|
||||
[Image] nvarchar(max) NOT NULL,
|
||||
[Author] nvarchar(max) NULL,
|
||||
[Items_Id] int NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- Creating table 'Currencies'
|
||||
CREATE TABLE [dbo].[Currencies] (
|
||||
[Id] int IDENTITY(1,1) NOT NULL,
|
||||
[Name] nvarchar(max) NOT NULL,
|
||||
[Type] nvarchar(max) NOT NULL,
|
||||
[Info] nvarchar(max) NULL,
|
||||
[CurrencyCategory_Id] int NOT NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- Creating table 'CurrencyCategories'
|
||||
CREATE TABLE [dbo].[CurrencyCategories] (
|
||||
[Id] int IDENTITY(1,1) NOT NULL,
|
||||
[Name] nvarchar(max) NOT NULL,
|
||||
[Type] nvarchar(max) NOT NULL,
|
||||
[CurrencyCategoryImage_Id] int NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- Creating table 'ItemCategoryImages'
|
||||
CREATE TABLE [dbo].[ItemCategoryImages] (
|
||||
[Id] int IDENTITY(1,1) NOT NULL,
|
||||
[Name] nvarchar(max) NOT NULL,
|
||||
[ImageURL] nvarchar(max) NULL,
|
||||
[Image] varbinary(max) NULL,
|
||||
[Author] nvarchar(max) NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- Creating table 'CurrencyImages'
|
||||
CREATE TABLE [dbo].[CurrencyImages] (
|
||||
[Id] int IDENTITY(1,1) NOT NULL,
|
||||
[Name] nvarchar(max) NOT NULL,
|
||||
[ImageURL] nvarchar(max) NULL,
|
||||
[Image] varbinary(max) NULL,
|
||||
[Author] nvarchar(max) NULL,
|
||||
[Currencies_Id] int NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- Creating table 'CurrencyCategoryImages'
|
||||
CREATE TABLE [dbo].[CurrencyCategoryImages] (
|
||||
[Id] int IDENTITY(1,1) NOT NULL,
|
||||
[Name] nvarchar(max) NOT NULL,
|
||||
[ImageURL] nvarchar(max) NULL,
|
||||
[Image] varbinary(max) NULL,
|
||||
[Author] nvarchar(max) NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- Creating table 'DealItemsPricePoints'
|
||||
CREATE TABLE [dbo].[DealItemsPricePoints] (
|
||||
[DealItem_Id] int NOT NULL,
|
||||
[PricePoints_Id] int NOT NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- Creating table 'PriceCategoriesPricePoints'
|
||||
CREATE TABLE [dbo].[PriceCategoriesPricePoints] (
|
||||
[PriceCategory_Id] int NOT NULL,
|
||||
[PricePoints_Id] int NOT NULL
|
||||
);
|
||||
GO
|
||||
|
||||
-- --------------------------------------------------
|
||||
-- Creating all PRIMARY KEY constraints
|
||||
-- --------------------------------------------------
|
||||
|
||||
-- Creating primary key on [Id] in table 'Items'
|
||||
ALTER TABLE [dbo].[Items]
|
||||
ADD CONSTRAINT [PK_Items]
|
||||
PRIMARY KEY CLUSTERED ([Id] ASC);
|
||||
GO
|
||||
|
||||
-- Creating primary key on [Id] in table 'ItemCategories'
|
||||
ALTER TABLE [dbo].[ItemCategories]
|
||||
ADD CONSTRAINT [PK_ItemCategories]
|
||||
PRIMARY KEY CLUSTERED ([Id] ASC);
|
||||
GO
|
||||
|
||||
-- Creating primary key on [Id] in table 'PriceCategories'
|
||||
ALTER TABLE [dbo].[PriceCategories]
|
||||
ADD CONSTRAINT [PK_PriceCategories]
|
||||
PRIMARY KEY CLUSTERED ([Id] ASC);
|
||||
GO
|
||||
|
||||
-- Creating primary key on [Id] in table 'PricePoints'
|
||||
ALTER TABLE [dbo].[PricePoints]
|
||||
ADD CONSTRAINT [PK_PricePoints]
|
||||
PRIMARY KEY CLUSTERED ([Id] ASC);
|
||||
GO
|
||||
|
||||
-- Creating primary key on [Id] in table 'Deals'
|
||||
ALTER TABLE [dbo].[Deals]
|
||||
ADD CONSTRAINT [PK_Deals]
|
||||
PRIMARY KEY CLUSTERED ([Id] ASC);
|
||||
GO
|
||||
|
||||
-- Creating primary key on [Id] in table 'DealItems'
|
||||
ALTER TABLE [dbo].[DealItems]
|
||||
ADD CONSTRAINT [PK_DealItems]
|
||||
PRIMARY KEY CLUSTERED ([Id] ASC);
|
||||
GO
|
||||
|
||||
-- Creating primary key on [Id] in table 'ItemImages'
|
||||
ALTER TABLE [dbo].[ItemImages]
|
||||
ADD CONSTRAINT [PK_ItemImages]
|
||||
PRIMARY KEY CLUSTERED ([Id] ASC);
|
||||
GO
|
||||
|
||||
-- Creating primary key on [Id] in table 'Currencies'
|
||||
ALTER TABLE [dbo].[Currencies]
|
||||
ADD CONSTRAINT [PK_Currencies]
|
||||
PRIMARY KEY CLUSTERED ([Id] ASC);
|
||||
GO
|
||||
|
||||
-- Creating primary key on [Id] in table 'CurrencyCategories'
|
||||
ALTER TABLE [dbo].[CurrencyCategories]
|
||||
ADD CONSTRAINT [PK_CurrencyCategories]
|
||||
PRIMARY KEY CLUSTERED ([Id] ASC);
|
||||
GO
|
||||
|
||||
-- Creating primary key on [Id] in table 'ItemCategoryImages'
|
||||
ALTER TABLE [dbo].[ItemCategoryImages]
|
||||
ADD CONSTRAINT [PK_ItemCategoryImages]
|
||||
PRIMARY KEY CLUSTERED ([Id] ASC);
|
||||
GO
|
||||
|
||||
-- Creating primary key on [Id] in table 'CurrencyImages'
|
||||
ALTER TABLE [dbo].[CurrencyImages]
|
||||
ADD CONSTRAINT [PK_CurrencyImages]
|
||||
PRIMARY KEY CLUSTERED ([Id] ASC);
|
||||
GO
|
||||
|
||||
-- Creating primary key on [Id] in table 'CurrencyCategoryImages'
|
||||
ALTER TABLE [dbo].[CurrencyCategoryImages]
|
||||
ADD CONSTRAINT [PK_CurrencyCategoryImages]
|
||||
PRIMARY KEY CLUSTERED ([Id] ASC);
|
||||
GO
|
||||
|
||||
-- Creating primary key on [DealItem_Id], [PricePoints_Id] in table 'DealItemsPricePoints'
|
||||
ALTER TABLE [dbo].[DealItemsPricePoints]
|
||||
ADD CONSTRAINT [PK_DealItemsPricePoints]
|
||||
PRIMARY KEY CLUSTERED ([DealItem_Id], [PricePoints_Id] ASC);
|
||||
GO
|
||||
|
||||
-- Creating primary key on [PriceCategory_Id], [PricePoints_Id] in table 'PriceCategoriesPricePoints'
|
||||
ALTER TABLE [dbo].[PriceCategoriesPricePoints]
|
||||
ADD CONSTRAINT [PK_PriceCategoriesPricePoints]
|
||||
PRIMARY KEY CLUSTERED ([PriceCategory_Id], [PricePoints_Id] ASC);
|
||||
GO
|
||||
|
||||
-- --------------------------------------------------
|
||||
-- Creating all FOREIGN KEY constraints
|
||||
-- --------------------------------------------------
|
||||
|
||||
-- Creating foreign key on [ItemCategory_Id] in table 'Items'
|
||||
ALTER TABLE [dbo].[Items]
|
||||
ADD CONSTRAINT [FK_ItemCategoryItem]
|
||||
FOREIGN KEY ([ItemCategory_Id])
|
||||
REFERENCES [dbo].[ItemCategories]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_ItemCategoryItem'
|
||||
CREATE INDEX [IX_FK_ItemCategoryItem]
|
||||
ON [dbo].[Items]
|
||||
([ItemCategory_Id]);
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [PriceCategory_Id] in table 'Items'
|
||||
ALTER TABLE [dbo].[Items]
|
||||
ADD CONSTRAINT [FK_PriceCategoryItem]
|
||||
FOREIGN KEY ([PriceCategory_Id])
|
||||
REFERENCES [dbo].[PriceCategories]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_PriceCategoryItem'
|
||||
CREATE INDEX [IX_FK_PriceCategoryItem]
|
||||
ON [dbo].[Items]
|
||||
([PriceCategory_Id]);
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [Deal_Id] in table 'DealItems'
|
||||
ALTER TABLE [dbo].[DealItems]
|
||||
ADD CONSTRAINT [FK_DealsDealItems]
|
||||
FOREIGN KEY ([Deal_Id])
|
||||
REFERENCES [dbo].[Deals]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_DealsDealItems'
|
||||
CREATE INDEX [IX_FK_DealsDealItems]
|
||||
ON [dbo].[DealItems]
|
||||
([Deal_Id]);
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [DealItem_Id] in table 'Items'
|
||||
ALTER TABLE [dbo].[Items]
|
||||
ADD CONSTRAINT [FK_DealItemsItems]
|
||||
FOREIGN KEY ([DealItem_Id])
|
||||
REFERENCES [dbo].[DealItems]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_DealItemsItems'
|
||||
CREATE INDEX [IX_FK_DealItemsItems]
|
||||
ON [dbo].[Items]
|
||||
([DealItem_Id]);
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [PriceCategory_Id] in table 'DealItems'
|
||||
ALTER TABLE [dbo].[DealItems]
|
||||
ADD CONSTRAINT [FK_DealItemsPriceCategories]
|
||||
FOREIGN KEY ([PriceCategory_Id])
|
||||
REFERENCES [dbo].[PriceCategories]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_DealItemsPriceCategories'
|
||||
CREATE INDEX [IX_FK_DealItemsPriceCategories]
|
||||
ON [dbo].[DealItems]
|
||||
([PriceCategory_Id]);
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [DealItem_Id] in table 'DealItemsPricePoints'
|
||||
ALTER TABLE [dbo].[DealItemsPricePoints]
|
||||
ADD CONSTRAINT [FK_DealItemsPricePoints_DealItems]
|
||||
FOREIGN KEY ([DealItem_Id])
|
||||
REFERENCES [dbo].[DealItems]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [PricePoints_Id] in table 'DealItemsPricePoints'
|
||||
ALTER TABLE [dbo].[DealItemsPricePoints]
|
||||
ADD CONSTRAINT [FK_DealItemsPricePoints_PricePoints]
|
||||
FOREIGN KEY ([PricePoints_Id])
|
||||
REFERENCES [dbo].[PricePoints]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_DealItemsPricePoints_PricePoints'
|
||||
CREATE INDEX [IX_FK_DealItemsPricePoints_PricePoints]
|
||||
ON [dbo].[DealItemsPricePoints]
|
||||
([PricePoints_Id]);
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [PriceCategory_Id] in table 'PriceCategoriesPricePoints'
|
||||
ALTER TABLE [dbo].[PriceCategoriesPricePoints]
|
||||
ADD CONSTRAINT [FK_PriceCategoriesPricePoints_PriceCategories]
|
||||
FOREIGN KEY ([PriceCategory_Id])
|
||||
REFERENCES [dbo].[PriceCategories]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [PricePoints_Id] in table 'PriceCategoriesPricePoints'
|
||||
ALTER TABLE [dbo].[PriceCategoriesPricePoints]
|
||||
ADD CONSTRAINT [FK_PriceCategoriesPricePoints_PricePoints]
|
||||
FOREIGN KEY ([PricePoints_Id])
|
||||
REFERENCES [dbo].[PricePoints]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_PriceCategoriesPricePoints_PricePoints'
|
||||
CREATE INDEX [IX_FK_PriceCategoriesPricePoints_PricePoints]
|
||||
ON [dbo].[PriceCategoriesPricePoints]
|
||||
([PricePoints_Id]);
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [DealItem_Id] in table 'ItemCategories'
|
||||
ALTER TABLE [dbo].[ItemCategories]
|
||||
ADD CONSTRAINT [FK_DealItemsItemCategories]
|
||||
FOREIGN KEY ([DealItem_Id])
|
||||
REFERENCES [dbo].[DealItems]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_DealItemsItemCategories'
|
||||
CREATE INDEX [IX_FK_DealItemsItemCategories]
|
||||
ON [dbo].[ItemCategories]
|
||||
([DealItem_Id]);
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [Items_Id] in table 'ItemImages'
|
||||
ALTER TABLE [dbo].[ItemImages]
|
||||
ADD CONSTRAINT [FK_ImagesItems]
|
||||
FOREIGN KEY ([Items_Id])
|
||||
REFERENCES [dbo].[Items]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_ImagesItems'
|
||||
CREATE INDEX [IX_FK_ImagesItems]
|
||||
ON [dbo].[ItemImages]
|
||||
([Items_Id]);
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [CurrencyCategory_Id] in table 'Currencies'
|
||||
ALTER TABLE [dbo].[Currencies]
|
||||
ADD CONSTRAINT [FK_CurrencyCategoryCurrencies]
|
||||
FOREIGN KEY ([CurrencyCategory_Id])
|
||||
REFERENCES [dbo].[CurrencyCategories]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_CurrencyCategoryCurrencies'
|
||||
CREATE INDEX [IX_FK_CurrencyCategoryCurrencies]
|
||||
ON [dbo].[Currencies]
|
||||
([CurrencyCategory_Id]);
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [Currency_Id] in table 'PricePoints'
|
||||
ALTER TABLE [dbo].[PricePoints]
|
||||
ADD CONSTRAINT [FK_PricePointsCurrencies]
|
||||
FOREIGN KEY ([Currency_Id])
|
||||
REFERENCES [dbo].[Currencies]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_PricePointsCurrencies'
|
||||
CREATE INDEX [IX_FK_PricePointsCurrencies]
|
||||
ON [dbo].[PricePoints]
|
||||
([Currency_Id]);
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [ItemCategoryImage_Id] in table 'ItemCategories'
|
||||
ALTER TABLE [dbo].[ItemCategories]
|
||||
ADD CONSTRAINT [FK_ItemCategoryImageItemCategory]
|
||||
FOREIGN KEY ([ItemCategoryImage_Id])
|
||||
REFERENCES [dbo].[ItemCategoryImages]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_ItemCategoryImageItemCategory'
|
||||
CREATE INDEX [IX_FK_ItemCategoryImageItemCategory]
|
||||
ON [dbo].[ItemCategories]
|
||||
([ItemCategoryImage_Id]);
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [CurrencyCategoryImage_Id] in table 'CurrencyCategories'
|
||||
ALTER TABLE [dbo].[CurrencyCategories]
|
||||
ADD CONSTRAINT [FK_CurrencyCategoryImageCurrencyCategory]
|
||||
FOREIGN KEY ([CurrencyCategoryImage_Id])
|
||||
REFERENCES [dbo].[CurrencyCategoryImages]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_CurrencyCategoryImageCurrencyCategory'
|
||||
CREATE INDEX [IX_FK_CurrencyCategoryImageCurrencyCategory]
|
||||
ON [dbo].[CurrencyCategories]
|
||||
([CurrencyCategoryImage_Id]);
|
||||
GO
|
||||
|
||||
-- Creating foreign key on [Currencies_Id] in table 'CurrencyImages'
|
||||
ALTER TABLE [dbo].[CurrencyImages]
|
||||
ADD CONSTRAINT [FK_CurrencyImageCurrency]
|
||||
FOREIGN KEY ([Currencies_Id])
|
||||
REFERENCES [dbo].[Currencies]
|
||||
([Id])
|
||||
ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
GO
|
||||
|
||||
-- Creating non-clustered index for FOREIGN KEY 'FK_CurrencyImageCurrency'
|
||||
CREATE INDEX [IX_FK_CurrencyImageCurrency]
|
||||
ON [dbo].[CurrencyImages]
|
||||
([Currencies_Id]);
|
||||
GO
|
||||
|
||||
-- --------------------------------------------------
|
||||
-- Script has ended
|
||||
-- --------------------------------------------------
|
||||
@@ -0,0 +1 @@
|
||||
// Models.edmx
|
||||
@@ -0,0 +1,845 @@
|
||||
<#@ template language="C#" debug="false" hostspecific="true"#>
|
||||
<#@ include file="EF.Utility.CS.ttinclude"#><#@
|
||||
output extension=".cs"#><#
|
||||
|
||||
const string inputFile = @"Models.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())
|
||||
{
|
||||
#>
|
||||
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)
|
||||
{
|
||||
#>
|
||||
<#=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>
|
||||
// <#=GetResourceString("Template_GeneratedCodeCommentLine1")#>
|
||||
//
|
||||
// <#=GetResourceString("Template_GeneratedCodeCommentLine2")#>
|
||||
// <#=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_EF5";
|
||||
|
||||
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 navigationProperty)
|
||||
{
|
||||
var endType = _typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType());
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0} {1} {2} {{ {3}get; {4}set; }}",
|
||||
AccessibilityAndVirtual(Accessibility.ForProperty(navigationProperty)),
|
||||
navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
|
||||
_code.Escape(navigationProperty),
|
||||
_code.SpaceAfter(Accessibility.ForGetter(navigationProperty)),
|
||||
_code.SpaceAfter(Accessibility.ForSetter(navigationProperty)));
|
||||
}
|
||||
|
||||
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(" + 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 => 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 => 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} 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 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);
|
||||
}
|
||||
|
||||
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, 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 class EdmMetadataLoader
|
||||
{
|
||||
private readonly IDynamicHost _host;
|
||||
private readonly System.Collections.IList _errors;
|
||||
|
||||
public EdmMetadataLoader(IDynamicHost host, System.Collections.IList errors)
|
||||
{
|
||||
ArgumentNotNull(host, "host");
|
||||
ArgumentNotNull(errors, "errors");
|
||||
|
||||
_host = host;
|
||||
_errors = errors;
|
||||
}
|
||||
|
||||
public IEnumerable<GlobalItem> CreateEdmItemCollection(string sourcePath)
|
||||
{
|
||||
ArgumentNotNull(sourcePath, "sourcePath");
|
||||
|
||||
if (!ValidateInputPath(sourcePath))
|
||||
{
|
||||
return new EdmItemCollection();
|
||||
}
|
||||
|
||||
var schemaElement = LoadRootElement(_host.ResolvePath(sourcePath));
|
||||
if (schemaElement != null)
|
||||
{
|
||||
using (var reader = schemaElement.CreateReader())
|
||||
{
|
||||
IList<EdmSchemaError> errors;
|
||||
var itemCollection = MetadataItemCollectionFactory.CreateEdmItemCollection(new[] { reader }, out errors);
|
||||
|
||||
ProcessErrors(errors, sourcePath);
|
||||
|
||||
return itemCollection;
|
||||
}
|
||||
}
|
||||
return new EdmItemCollection();
|
||||
}
|
||||
|
||||
public string GetModelNamespace(string sourcePath)
|
||||
{
|
||||
ArgumentNotNull(sourcePath, "sourcePath");
|
||||
|
||||
if (!ValidateInputPath(sourcePath))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var model = LoadRootElement(_host.ResolvePath(sourcePath));
|
||||
if (model == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var attribute = model.Attribute("Namespace");
|
||||
return attribute != null ? attribute.Value : "";
|
||||
}
|
||||
|
||||
private bool ValidateInputPath(string sourcePath)
|
||||
{
|
||||
if (sourcePath == "$" + "edmxInputFile" + "$")
|
||||
{
|
||||
_errors.Add(
|
||||
new CompilerError(_host.TemplateFile ?? sourcePath, 0, 0, string.Empty,
|
||||
GetResourceString("Template_ReplaceVsItemTemplateToken")));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public XElement LoadRootElement(string sourcePath)
|
||||
{
|
||||
ArgumentNotNull(sourcePath, "sourcePath");
|
||||
|
||||
var root = XElement.Load(sourcePath, LoadOptions.SetBaseUri | LoadOptions.SetLineInfo);
|
||||
return root.Elements()
|
||||
.Where(e => e.Name.LocalName == "Runtime")
|
||||
.Elements()
|
||||
.Where(e => e.Name.LocalName == "ConceptualModels")
|
||||
.Elements()
|
||||
.Where(e => e.Name.LocalName == "Schema")
|
||||
.FirstOrDefault()
|
||||
?? root;
|
||||
}
|
||||
|
||||
private void ProcessErrors(IEnumerable<EdmSchemaError> errors, string sourceFilePath)
|
||||
{
|
||||
foreach (var error in errors)
|
||||
{
|
||||
_errors.Add(
|
||||
new CompilerError(
|
||||
error.SchemaLocation ?? sourceFilePath,
|
||||
error.Line,
|
||||
error.Column,
|
||||
error.ErrorCode.ToString(CultureInfo.InvariantCulture),
|
||||
error.Message)
|
||||
{
|
||||
IsWarning = error.Severity == EdmSchemaErrorSeverity.Warning
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsLazyLoadingEnabled(EntityContainer container)
|
||||
{
|
||||
string lazyLoadingAttributeValue;
|
||||
var lazyLoadingAttributeName = MetadataConstants.EDM_ANNOTATION_09_02 + ":LazyLoadingEnabled";
|
||||
bool isLazyLoading;
|
||||
return !MetadataTools.TryGetStringMetadataPropertySetting(container, lazyLoadingAttributeName, out lazyLoadingAttributeValue)
|
||||
|| !bool.TryParse(lazyLoadingAttributeValue, out isLazyLoading)
|
||||
|| isLazyLoading;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ArgumentNotNull<T>(T arg, string name) where T : class
|
||||
{
|
||||
if (arg == null)
|
||||
{
|
||||
throw new ArgumentNullException(name);
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Lazy<System.Resources.ResourceManager> ResourceManager =
|
||||
new Lazy<System.Resources.ResourceManager>(
|
||||
() => new System.Resources.ResourceManager("System.Data.Entity.Design", typeof(MetadataItemCollectionFactory).Assembly), isThreadSafe: true);
|
||||
|
||||
public static string GetResourceString(string resourceName)
|
||||
{
|
||||
ArgumentNotNull(resourceName, "resourceName");
|
||||
|
||||
return ResourceManager.Value.GetString(resourceName, null);
|
||||
}
|
||||
|
||||
#>
|
||||
@@ -0,0 +1,32 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class PriceCategory
|
||||
{
|
||||
public PriceCategory()
|
||||
{
|
||||
this.Items = new HashSet<Item>();
|
||||
this.DealItem = new HashSet<DealItem>();
|
||||
this.PricePoints = new HashSet<PricePoint>();
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Info { get; set; }
|
||||
|
||||
public virtual ICollection<Item> Items { get; set; }
|
||||
public virtual ICollection<DealItem> DealItem { get; set; }
|
||||
public virtual ICollection<PricePoint> PricePoints { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class PricePoint
|
||||
{
|
||||
public PricePoint()
|
||||
{
|
||||
this.DealItem = new HashSet<DealItem>();
|
||||
this.PriceCategory = new HashSet<PriceCategory>();
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
public double Qty { get; set; }
|
||||
|
||||
public virtual ICollection<DealItem> DealItem { get; set; }
|
||||
public virtual ICollection<PriceCategory> PriceCategory { get; set; }
|
||||
public virtual Currency Currency { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Simple_Shop.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public enum Tangibility : int
|
||||
{
|
||||
Unknown = 1,
|
||||
Tangible = 2,
|
||||
Intangible = 4
|
||||
}
|
||||
}
|
||||
@@ -46,10 +46,18 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
@@ -165,6 +173,60 @@
|
||||
<Compile Include="Global.asax.cs">
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\Currency.cs">
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\CurrencyCategory.cs">
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\CurrencyCategoryImage.cs">
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\CurrencyImage.cs">
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\Deal.cs">
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\DealItem.cs">
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\Item.cs">
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\ItemCategory.cs">
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\ItemCategoryImage.cs">
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\ItemImage.cs">
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\Models.Context.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Models.Context.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\Models.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\Models.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Models.edmx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\PriceCategory.cs">
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\PricePoint.cs">
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\Tangibility.cs">
|
||||
<DependentUpon>Models.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -176,11 +238,32 @@
|
||||
<Content Include="fonts\glyphicons-halflings-regular.svg" />
|
||||
<Content Include="Global.asax" />
|
||||
<Content Include="Content\Site.css" />
|
||||
<Content Include="Models\Models.Context.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>Models.Context.cs</LastGenOutput>
|
||||
<DependentUpon>Models.edmx</DependentUpon>
|
||||
</Content>
|
||||
<None Include="Models\Models.edmx.sql.bak" />
|
||||
<Content Include="Models\Models.edmx.sql" />
|
||||
<Content Include="Models\Models.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>Models.cs</LastGenOutput>
|
||||
<DependentUpon>Models.edmx</DependentUpon>
|
||||
</Content>
|
||||
<Content Include="Models\Backups\11-13-2019%4009.48.rar" />
|
||||
<None Include="Models\Models.md" />
|
||||
<Content Include="Scripts\bootstrap.js" />
|
||||
<Content Include="Scripts\bootstrap.min.js" />
|
||||
<Content Include="ApplicationInsights.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<EntityDeploy Include="Models\Models.edmx">
|
||||
<Generator>EntityModelCodeGenerator</Generator>
|
||||
<LastGenOutput>Models.Designer.cs</LastGenOutput>
|
||||
</EntityDeploy>
|
||||
<Content Include="Models\Models.edmx.diagram">
|
||||
<DependentUpon>Models.edmx</DependentUpon>
|
||||
</Content>
|
||||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" />
|
||||
<None Include="Properties\PublishProfiles\simple-shop.seriussoft.com - Web Deploy.pubxml" />
|
||||
<None Include="Scripts\jquery-3.3.1.intellisense.js" />
|
||||
@@ -211,7 +294,8 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
<Folder Include="Models\" />
|
||||
<Folder Include="Models\Backups\11-13-2019%4009.48\" />
|
||||
<Folder Include="Views\Add\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="fonts\glyphicons-halflings-regular.woff2" />
|
||||
@@ -226,6 +310,9 @@
|
||||
<Content Include="Scripts\jquery-3.3.1.slim.min.map" />
|
||||
<Content Include="Scripts\jquery-3.3.1.min.map" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@{
|
||||
ViewBag.Title = "Home Page";
|
||||
//ViewBag.Items =
|
||||
}
|
||||
|
||||
<div class="jumbotron">
|
||||
|
||||
+48
-42
@@ -4,82 +4,88 @@
|
||||
https://go.microsoft.com/fwlink/?LinkId=301880
|
||||
-->
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
</configSections>
|
||||
<appSettings>
|
||||
<add key="webpages:Version" value="3.0.0.0"/>
|
||||
<add key="webpages:Enabled" value="false"/>
|
||||
<add key="ClientValidationEnabled" value="true"/>
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
|
||||
<add key="webpages:Version" value="3.0.0.0" />
|
||||
<add key="webpages:Enabled" value="false" />
|
||||
<add key="ClientValidationEnabled" value="true" />
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.7.2"/>
|
||||
<httpRuntime targetFramework="4.7.2"/>
|
||||
<compilation debug="true" targetFramework="4.7.2" />
|
||||
<httpRuntime targetFramework="4.7.2" />
|
||||
<httpModules>
|
||||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
|
||||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
|
||||
</httpModules>
|
||||
</system.web>
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
|
||||
<remove name="OPTIONSVerbHandler"/>
|
||||
<remove name="TRACEVerbHandler"/>
|
||||
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler"
|
||||
preCondition="integratedMode,runtimeVersionv4.0"/>
|
||||
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
|
||||
<remove name="OPTIONSVerbHandler" />
|
||||
<remove name="TRACEVerbHandler" />
|
||||
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
|
||||
</handlers>
|
||||
<modules>
|
||||
<remove name="TelemetryCorrelationHttpModule"/>
|
||||
<add name="TelemetryCorrelationHttpModule"
|
||||
type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation"
|
||||
preCondition="integratedMode,managedHandler"/>
|
||||
<remove name="ApplicationInsightsWebTracking"/>
|
||||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
|
||||
preCondition="managedHandler"/>
|
||||
<remove name="TelemetryCorrelationHttpModule" />
|
||||
<add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation" preCondition="integratedMode,managedHandler" />
|
||||
<remove name="ApplicationInsightsWebTracking" />
|
||||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
|
||||
</modules>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
<validation validateIntegratedModeConfiguration="false" />
|
||||
</system.webServer>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2"/>
|
||||
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1"/>
|
||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0"/>
|
||||
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930"/>
|
||||
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0"/>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
|
||||
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.4.0" newVersion="5.2.4.0"/>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.4.0" newVersion="5.2.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.codedom>
|
||||
<compilers>
|
||||
<compiler language="c#;cs;csharp" extension=".cs"
|
||||
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
|
||||
warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
|
||||
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
|
||||
warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+"/>
|
||||
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
|
||||
</compilers>
|
||||
</system.codedom>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<connectionStrings>
|
||||
<add name="ItemContainer" connectionString="metadata=res://*/Models.Backup.Models.edmx.csdl|res://*/Models.Backup.Models.edmx.ssdl|res://*/Models.Backup.Models.edmx.msl;provider=System.Data.SqlClient;provider connection string="data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=D:\@Dev\_\_Repo.ASPnix\simple-shop\_data\simple-shop-0.mdf;integrated security=True;multipleactiveresultsets=True;connect timeout=30;App=EntityFramework"" providerName="System.Data.EntityClient" />
|
||||
</connectionStrings>
|
||||
</configuration>
|
||||
@@ -2,6 +2,7 @@
|
||||
<packages>
|
||||
<package id="Antlr" version="3.5.0.2" targetFramework="net472" />
|
||||
<package id="bootstrap" version="3.3.7" targetFramework="net472" />
|
||||
<package id="EntityFramework" version="6.1.3" targetFramework="net472" />
|
||||
<package id="jQuery" version="3.3.1" targetFramework="net472" />
|
||||
<package id="jQuery.Validation" version="1.17.0" targetFramework="net472" />
|
||||
<package id="Microsoft.ApplicationInsights" version="2.5.1" targetFramework="net472" />
|
||||
|
||||
Reference in New Issue
Block a user