Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions MetallicBlueDev.EntityGate/MetallicBlueDev.EntityGate.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetallicBlueDev.EntityGate", "MetallicBlueDev.EntityGate\MetallicBlueDev.EntityGate.csproj", "{1898D29F-7FE8-4C29-A6FF-57860703D4D0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetallicBlueDev.Sample.EntityGate", "MetallicBlueDev.Sample.EntityGate\MetallicBlueDev.Sample.EntityGate.csproj", "{CD267A11-4D5F-4AA9-B411-29E630681909}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetallicBlueDev.Sample.Data", "MetallicBlueDev.Sample.Data\MetallicBlueDev.Sample.Data.csproj", "{52F9655C-6895-4FBC-B3D2-F50EA9CC5356}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -20,6 +24,14 @@ Global
{1898D29F-7FE8-4C29-A6FF-57860703D4D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1898D29F-7FE8-4C29-A6FF-57860703D4D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1898D29F-7FE8-4C29-A6FF-57860703D4D0}.Release|Any CPU.Build.0 = Release|Any CPU
{CD267A11-4D5F-4AA9-B411-29E630681909}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD267A11-4D5F-4AA9-B411-29E630681909}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD267A11-4D5F-4AA9-B411-29E630681909}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD267A11-4D5F-4AA9-B411-29E630681909}.Release|Any CPU.Build.0 = Release|Any CPU
{52F9655C-6895-4FBC-B3D2-F50EA9CC5356}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52F9655C-6895-4FBC-B3D2-F50EA9CC5356}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52F9655C-6895-4FBC-B3D2-F50EA9CC5356}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52F9655C-6895-4FBC-B3D2-F50EA9CC5356}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public int Timeout
///
/// If the main entity implements the <see cref="InterfacedObject.IEntityObjectArchival"/> interface, the backup is automatically enabled.
/// </summary>
public bool AutomaticCheckOfOriginValues { get; set; }
public bool AutomaticCheckOfOriginalValues { get; set; }

/// <summary>
/// Log internal messages. Include messages from Entity Framework.
Expand Down Expand Up @@ -143,10 +143,7 @@ public void ChangeConnectionString(string connectionName)

if (currentConfig != null)
{
MaximumNumberOfAttempts = currentConfig.MaximumNumberOfAttempts;
AttemptDelay = currentConfig.AttemptDelay;
LazyLoading = currentConfig.LazyLoading;
ConnectionString = EntityGateConfigLoader.GetConnectionString(currentConfig.ConnectionName);
CopyConfiguration(currentConfig);

if (CanUseLogging)
{
Expand Down Expand Up @@ -205,6 +202,21 @@ internal void ConfigurationUpdated()
}
}

/// <summary>
/// Copy of the configuration.
/// </summary>
/// <param name="config"></param>
private void CopyConfiguration(EntityGateConfig config)
{
ConnectionString = EntityGateConfigLoader.GetConnectionString(config.ConnectionName);

MaximumNumberOfAttempts = config.MaximumNumberOfAttempts;
AttemptDelay = config.AttemptDelay;
LazyLoading = config.LazyLoading;
Timeout = config.Timeout;
AutomaticCheckOfOriginalValues = config.AutomaticCheckOfOriginalValues;
}

/// <summary>
/// Indicates that the context is synchronized to this configuration.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ internal class EntityGateConfig
/// <summary>
/// Determines if the backup of the original values is performed automatically.
/// </summary>
internal bool AutomaticCheckOfOriginValues { get; set; } = true;
internal bool AutomaticCheckOfOriginalValues { get; set; } = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ private void FireAutoSaveOriginalValues()
/// </summary>
private void CheckEntityForAutoSaveOriginalValues()
{
if (Configuration.AutomaticCheckOfOriginValues)
if (Configuration.AutomaticCheckOfOriginalValues)
{
var oldState = Token.SaveOriginalValues;
var newState = entity.IsEntityArchival();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@
<Compile Include="Core\EntityGateTracking.cs" />
<Compile Include="Core\EntityStateTracking.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.configsample" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EntityFramework">
<Version>6.3.0</Version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MetallicBlueDev.EntityGate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("EntityGate")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("MetallicBlueDev")]
[assembly: AssemblyProduct("MetallicBlueDev.EntityGate")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyCopyright("MetallicBlueDev")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="SampleDataContainer" connectionString="metadata=res://*/SampleData.csdl|res://*/SampleData.ssdl|res://*/SampleData.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\SampleDbTest.mdf;integrated security=True;connect timeout=30;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{52F9655C-6895-4FBC-B3D2-F50EA9CC5356}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MetallicBlueDev.Sample.Data</RootNamespace>
<AssemblyName>MetallicBlueDev.Sample.Data</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="OtherEntity.Interface.cs" />
<Compile Include="SampleEntity1.Interface.cs" />
<Compile Include="OtherEntity.cs">
<DependentUpon>SampleData.tt</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SampleData.Context.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>SampleData.Context.tt</DependentUpon>
</Compile>
<Compile Include="SampleData.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>SampleData.tt</DependentUpon>
</Compile>
<Compile Include="SampleData.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>SampleData.edmx</DependentUpon>
</Compile>
<Compile Include="SampleEntity1.cs">
<DependentUpon>SampleData.tt</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EntityDeploy Include="SampleData.edmx">
<Generator>EntityModelCodeGenerator</Generator>
<LastGenOutput>SampleData.Designer.cs</LastGenOutput>
</EntityDeploy>
</ItemGroup>
<ItemGroup>
<None Include="App.Config" />
<None Include="SampleData.edmx.diagram">
<DependentUpon>SampleData.edmx</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="SampleData.Context.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>SampleData.Context.cs</LastGenOutput>
<DependentUpon>SampleData.edmx</DependentUpon>
</Content>
<Content Include="SampleData.edmx.sql" />
<Content Include="SampleData.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>SampleData.cs</LastGenOutput>
<DependentUpon>SampleData.edmx</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EntityFramework">
<Version>6.3.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MetallicBlueDev.EntityGate\MetallicBlueDev.EntityGate.csproj">
<Project>{1898D29F-7FE8-4C29-A6FF-57860703D4D0}</Project>
<Name>MetallicBlueDev.EntityGate</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using MetallicBlueDev.EntityGate.InterfacedObject;

namespace MetallicBlueDev.Sample.Data
{
public partial class OtherEntity : IEntityObjectIdentifier
{
/// <summary>
/// Mandatory implementation of the <see cref="IEntityObjectIdentifier"/> interface.
/// </summary>
public object Identifier => Id;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//------------------------------------------------------------------------------
// <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 MetallicBlueDev.Sample.Data
{
public partial class OtherEntity
{
public int Id { get; set; }
public string Description { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MetallicBlueDev.Sample.Data")]
[assembly: AssemblyDescription("Sample.Data")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("MetallicBlueDev")]
[assembly: AssemblyProduct("MetallicBlueDev.Sample.Data")]
[assembly: AssemblyCopyright("MetallicBlueDev")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("52f9655c-6895-4fbc-b3d2-f50ea9cc5356")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -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 MetallicBlueDev.Sample.Data
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;

public partial class SampleDataContainer : DbContext
{
public SampleDataContainer()
: base("name=SampleDataContainer")
{
}

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}

public virtual DbSet<SampleEntity1> SampleEntity1Set { get; set; }
public virtual DbSet<OtherEntity> OtherEntitySet { get; set; }
}
}
Loading