Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
839ea09
upgrade to EF6
pwelter34 Oct 22, 2013
0793a0a
- update to EF6
pwelter34 Oct 22, 2013
4f070e8
update entities
pwelter34 Oct 22, 2013
62b2b04
update package
pwelter34 Oct 22, 2013
3b62f90
- convert to nunit
pwelter34 Oct 22, 2013
f4aadf9
Adding async support
taschmidt Nov 12, 2013
7a989ce
Change FromCache to return an IList instead of IEnumerable
taschmidt Nov 13, 2013
543bb51
- add DataContract attributes
Jan 24, 2014
f2e635b
fix build
Jan 24, 2014
2281b3a
Projects are upgraded to EF 6.1 and compatibility issues are fixed.
Mar 18, 2014
f86f7eb
code formatting: spaces are restored
Mar 18, 2014
2aa5c3c
Merge pull request #75 from taschmidt/master
pwelter34 Mar 20, 2014
387477e
Merge pull request #88 from StasPerekrestov/master
pwelter34 Mar 20, 2014
1f830c6
EF 6.1 support
Mar 23, 2014
2a999b9
fix build
Mar 23, 2014
6129ef8
add new Metadata mapping
Apr 21, 2014
8ae1c79
try to fix test
Apr 21, 2014
e06943f
Handle inheritance when determining mapping
ocdi Apr 23, 2014
2219133
Merge pull request #96 from ocdi/master
pwelter34 Apr 23, 2014
283caae
Fixed audit not always setting correct display value for optional rel…
wimr Aug 13, 2014
46853ee
Merge pull request #120 from wimr/master
pwelter34 Aug 13, 2014
bc206f3
Merge pull request #1 from loresoft/master
wimr Aug 25, 2014
a5f4df4
fix for issue #123: Auditlogger gives nullreference exception when tr…
wimr Aug 25, 2014
42a5266
Merge pull request #124 from wimr/master
pwelter34 Aug 27, 2014
5eaa3ad
refactor for new build
pwelter34 Aug 28, 2014
3744c09
tweak build
pwelter34 Aug 28, 2014
e3a0f79
tweak build
pwelter34 Sep 2, 2014
d7a6989
more build work
pwelter34 Sep 2, 2014
739ab37
fix xunit runner
pwelter34 Sep 2, 2014
8e2fccf
restore database on build
pwelter34 Sep 2, 2014
fc8d2f2
add all tests to build
pwelter34 Sep 2, 2014
d675db9
fix sql ddl restore
pwelter34 Sep 2, 2014
6eab682
build changes
pwelter34 Sep 3, 2014
58b7452
update build script to use sql 2014
Sep 3, 2014
a3e8a55
change when sql database is restored
Sep 3, 2014
0d2a5f3
- cleanup project
Sep 3, 2014
52f7eed
tweak unit testing
Sep 3, 2014
54161b0
more build tweaks
Sep 4, 2014
6d5966a
use SqlPackage to restore database
Sep 4, 2014
e2814c2
update connection string
Sep 4, 2014
428401a
fix tests
Sep 4, 2014
d2f2487
fix async issue
pwelter34 Sep 12, 2014
bb24f01
add IncludeInserts and IncludeDeletes to logging Configuration
pwelter34 Jan 5, 2015
244e468
fix failing test
pwelter34 Jan 5, 2015
0f4eab3
more test fixes
pwelter34 Jan 5, 2015
26f23b8
test fix
pwelter34 Jan 5, 2015
ef14ba4
disable test
pwelter34 Jan 6, 2015
29d5807
Clear Cache
PatelVish Jan 30, 2015
c7577ef
fix future queries running under transaction
DzheiZee Mar 18, 2015
0c7ff8a
Fix Bug "Sequence Contains More Than One Element"
acymiranda Mar 18, 2015
d6a563a
Revert "Fix Bug "Sequence Contains More Than One Element""
acymiranda Mar 18, 2015
950b0c3
Fix bug “Sequence contains more than one element” #101
acymiranda Mar 18, 2015
569128a
Merge pull request #156 from acymiranda/master
pwelter34 Mar 19, 2015
81ff0b2
Merge pull request #155 from DzheiZee/master
pwelter34 Mar 19, 2015
af32558
Merge pull request #146 from PatelVish/master
pwelter34 Mar 19, 2015
9772c75
updated nuget badge icons
pwelter34 Mar 22, 2015
3fd30ac
Fix bug "Delete with multiple EDMX"
acymiranda Mar 27, 2015
9cae97a
Merge pull request #157 from acymiranda/master
pwelter34 Mar 27, 2015
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
Prev Previous commit
Next Next commit
- add DataContract attributes
- fix Audit schema
  • Loading branch information
paul.welter committed Jan 24, 2014
commit 543bb51182511efebdec5e4c950c38053f66e4ed
133 changes: 77 additions & 56 deletions Source/EntityFramework.Extended/Audit/Audit.xsd
Original file line number Diff line number Diff line change
@@ -1,57 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs ="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified"
elementFormDefault="qualified"
xmlns="http://schemas.tempuri.org/ef/audit/1.0"
targetNamespace="http://schemas.tempuri.org/ef/audit/1.0">

<xs:element name="audit" type="AuditLog">
<xs:annotation>
<xs:documentation>The root of the audit log.</xs:documentation>
</xs:annotation>
</xs:element>

<xs:complexType name="AuditLog">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="entity" type="AuditEntity" />
</xs:sequence>
<xs:attribute name="username" type="xs:string" use="optional" />
<xs:attribute name="date" type="xs:dateTime" use="optional" />
</xs:complexType>

<xs:complexType name="AuditEntity">
<xs:sequence>
<xs:element name="key" type="AuditKey" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="property" type="AuditProperty" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="action" type="AuditAction" use="required" />
<xs:attribute name="type" type="xs:string" use="required" />
</xs:complexType>

<xs:complexType name="AuditKey">
<xs:sequence minOccurs="0">
<xs:element minOccurs="0" name="value" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="type" type="xs:string" use="optional" />
</xs:complexType>

<xs:complexType name="AuditProperty">
<xs:sequence minOccurs="0">
<xs:element minOccurs="0" name="current" />
<xs:element minOccurs="0" name="original" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="type" type="xs:string" use="optional" />
</xs:complexType>

<xs:simpleType name="AuditAction">
<xs:restriction base="xs:string">
<xs:enumeration value="Added"/>
<xs:enumeration value="Modified"/>
<xs:enumeration value="Deleted"/>
</xs:restriction>
</xs:simpleType>

</xs:schema>
<xsd:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xs ="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified"
elementFormDefault="qualified"
xmlns="http://schemas.tempuri.org/ef/audit/2.0"
targetNamespace="http://schemas.tempuri.org/ef/audit/2.0">

<xsd:element name="audit" type="AuditLog">
<xsd:annotation>
<xsd:documentation>The root of the audit log.</xsd:documentation>
</xsd:annotation>
</xsd:element>

<xsd:complexType name="AuditLog">
<xsd:sequence>
<xsd:element name="username" type="xsd:string" />
<xsd:element name="date" type="xsd:dateTime" />
<xsd:element name="entities" type="AuditEntityCollection" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="AuditEntityCollection">
<xsd:sequence>
<xsd:element name="entity" type="AuditEntity" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="AuditEntity">
<xsd:sequence>
<xsd:element name="action" type="xsd:string" />
<xsd:element name="type" type="xsd:string" />
<xsd:element minOccurs="0" name="keys" type="AuditKeyCollection" />
<xsd:element minOccurs="0" name="properties" type="AuditPropertyCollection" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="AuditKeyCollection">
<xsd:sequence>
<xsd:element name="key" type="AuditKey" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="AuditPropertyCollection">
<xsd:sequence>
<xsd:element name="property" type="AuditProperty" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="AuditKey">
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<xsd:element minOccurs="0" name="type" type="xsd:string" />
<xsd:element minOccurs="0" name="value" type="xsd:anyType" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="AuditProperty">
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<xsd:element minOccurs="0" name="type" type="xsd:string" />
<xsd:element minOccurs="0" name="isRelationship" type="xsd:boolean" />
<xsd:element minOccurs="0" name="foreignKey" type="xsd:string" />
<xsd:element minOccurs="0" name="current" type="xsd:anyType" />
<xsd:element minOccurs="0" name="original" type="xsd:anyType" />
</xsd:sequence>
</xsd:complexType>

<xsd:simpleType name="AuditAction">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Added"/>
<xsd:enumeration value="Modified"/>
<xsd:enumeration value="Deleted"/>
</xsd:restriction>
</xsd:simpleType>

</xsd:schema>
8 changes: 7 additions & 1 deletion Source/EntityFramework.Extended/Audit/AuditAction.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
namespace EntityFramework.Audit
using System.Runtime.Serialization;

namespace EntityFramework.Audit
{
/// <summary>
/// A list of entity actions for the audit log.
/// </summary>
[DataContract(Name = "action", Namespace = AuditLog.AuditNamespace)]
public enum AuditAction
{
/// <summary>
/// The entity was inserted/added.
/// </summary>
[EnumMember]
Added = 1,
/// <summary>
/// The entity was updated/modifed.
/// </summary>
[EnumMember]
Modified = 2,
/// <summary>
/// The entity was deleted.
/// </summary>
[EnumMember]
Deleted = 3
}
}
16 changes: 12 additions & 4 deletions Source/EntityFramework.Extended/Audit/AuditEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Data.Entity.Core.Objects;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using EntityFramework.Audit;

Expand All @@ -12,6 +13,7 @@ namespace EntityFramework.Audit
/// A class for logging the changes to an entity.
/// </summary>
[XmlRoot(Namespace = AuditLog.AuditNamespace, ElementName = "entity")]
[DataContract(Name = "entity", Namespace = AuditLog.AuditNamespace)]
[DebuggerDisplay("Action: {Action}, Type: {Type}")]
public class AuditEntity : IEquatable<AuditEntity>
{
Expand Down Expand Up @@ -47,21 +49,25 @@ public AuditEntity(object current)
/// Gets or sets the action that was taken on the entity.
/// </summary>
/// <value>The action that was taken on the entity.</value>
[XmlAttribute("action")]
[XmlElement("action")]
[DataMember(Name = "action", Order = 0)]
public AuditAction Action { get; set; }

/// <summary>
/// Gets or sets the data type of the entity.
/// </summary>
/// <value>The data type of the entity.</value>
[XmlAttribute("type")]
[XmlElement("type")]
[DataMember(Name = "type", Order = 1)]
public string Type { get; set; }

/// <summary>
/// Gets the list of properties that are the key for the entity.
/// </summary>
/// <value>The list of properties that are the key for the entity.</value>
[XmlElement("key", typeof(AuditKey))]
[XmlArray("keys")]
[XmlArrayItem("key")]
[DataMember(Name = "keys", Order = 2)]
public AuditKeyCollection Keys { get; set; }

/// <summary>
Expand Down Expand Up @@ -89,7 +95,9 @@ public Type EntityType
/// Gets the list of properties that action was taken on.
/// </summary>
/// <value>The list of properties that action was taken on.</value>
[XmlElement("property", typeof(AuditProperty))]
[XmlArray("properties")]
[XmlArrayItem("property")]
[DataMember(Name = "properties", Order = 3)]
public AuditPropertyCollection Properties { get; set; }

/// <summary>
Expand Down
9 changes: 7 additions & 2 deletions Source/EntityFramework.Extended/Audit/AuditKey.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Xml.Serialization;

namespace EntityFramework.Audit
Expand All @@ -7,28 +8,32 @@ namespace EntityFramework.Audit
/// A class used to hold audit key values.
/// </summary>
[XmlRoot(Namespace = AuditLog.AuditNamespace, ElementName = "key")]
[DataContract(Name = "key", Namespace = AuditLog.AuditNamespace)]
[DebuggerDisplay("Name: {Name}, Value: {Value}")]
public class AuditKey
{
/// <summary>
/// Gets or sets the name of the property.
/// </summary>
/// <value>The name of the property.</value>
[XmlAttribute("name")]
[XmlElement("name")]
[DataMember(Name = "name", Order = 0)]
public string Name { get; set; }

/// <summary>
/// Gets or sets the type of the property.
/// </summary>
/// <value>The type of the property.</value>
[XmlAttribute("type")]
[XmlElement("type")]
[DataMember(Name = "type", Order = 1)]
public string Type { get; set; }

/// <summary>
/// Gets or sets the current/changed value of the property.
/// </summary>
/// <value>The current value of the property.</value>
[XmlElement("value")]
[DataMember(Name = "value", Order = 2)]
public object Value { get; set; }
}
}
2 changes: 2 additions & 0 deletions Source/EntityFramework.Extended/Audit/AuditKeyCollection.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System.Collections.ObjectModel;
using System.Runtime.Serialization;

namespace EntityFramework.Audit
{
/// <summary>
/// A keyed collection of <see cref="AuditKey"/>
/// </summary>
[CollectionDataContract(Name = "keys", ItemName = "key", Namespace = AuditLog.AuditNamespace)]
public class AuditKeyCollection : KeyedCollection<string, AuditKey>
{
/// <summary>
Expand Down
14 changes: 10 additions & 4 deletions Source/EntityFramework.Extended/Audit/AuditLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
Expand All @@ -13,12 +14,13 @@ namespace EntityFramework.Audit
/// A class representing a log of the changes.
/// </summary>
[XmlRoot(Namespace = AuditNamespace, ElementName = "audit")]
[DataContract(Name = "audit", Namespace = AuditNamespace)]
public class AuditLog
{
/// <summary>
/// The schema namespace for the audit log.
/// </summary>
public const string AuditNamespace = "http://schemas.tempuri.org/ef/audit/1.0";
public const string AuditNamespace = "http://schemas.tempuri.org/ef/audit/2.0";

private static readonly Lazy<XmlSerializer> _serializer;

Expand All @@ -40,21 +42,25 @@ public AuditLog()
/// Gets or sets the user name that made the changes.
/// </summary>
/// <value>The user name that made the changes.</value>
[XmlAttribute("username")]
[XmlElement("username")]
[DataMember(Name = "username", Order = 0)]
public string Username { get; set; }

/// <summary>
/// Gets or sets the date when the changes were made.
/// </summary>
/// <value>The date when the changes were made.</value>
[XmlAttribute("date")]
[XmlElement("date")]
[DataMember(Name = "date", Order = 1)]
public DateTime Date { get; set; }

/// <summary>
/// Gets the list entities that have changes.
/// </summary>
/// <value>The list entities that have changes.</value>
[XmlElement("entity", typeof(AuditEntity))]
[XmlArray("entities")]
[XmlArrayItem("entity")]
[DataMember(Name = "entities", Order = 2)]
public List<AuditEntity> Entities { get; set; }

/// <summary>
Expand Down
15 changes: 11 additions & 4 deletions Source/EntityFramework.Extended/Audit/AuditProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@ namespace EntityFramework.Audit
/// A class for logging the changes to a property on an entity.
/// </summary>
[XmlRoot(Namespace = AuditLog.AuditNamespace, ElementName = "property")]
[DataContract(Name = "property", Namespace = AuditLog.AuditNamespace)]
[DebuggerDisplay("Name: {Name}, Type: {Type}")]
public class AuditProperty
{
/// <summary>
/// Gets or sets the name of the property.
/// </summary>
/// <value>The name of the property.</value>
[XmlAttribute("name")]
[XmlElement("name")]
[DataMember(Name = "name", Order = 0)]
public string Name { get; set; }

/// <summary>
/// Gets or sets the type of the property.
/// </summary>
/// <value>The type of the property.</value>
[XmlAttribute("type")]
[XmlElement("type")]
[DataMember(Name = "type", Order = 1)]
public string Type { get; set; }

/// <summary>
Expand All @@ -32,29 +35,33 @@ public class AuditProperty
/// <value>
/// <c>true</c> if this property is an association; otherwise, <c>false</c>.
/// </value>
[XmlAttribute("isRelationship")]
[XmlElement("isRelationship")]
[DefaultValue(false)]
[DataMember(Name = "isRelationship", Order = 2, EmitDefaultValue = false)]
public bool IsRelationship { get; set; }

/// <summary>
/// Gets or sets the property names that this association maps to.
/// </summary>
/// <value>The property names that this association maps to..</value>
[XmlAttribute("foreignKey")]
[XmlElement("foreignKey")]
[DataMember(Name = "foreignKey", Order = 3, EmitDefaultValue = false)]
public string ForeignKey { get; set; }

/// <summary>
/// Gets or sets the current/changed value of the property.
/// </summary>
/// <value>The current value of the property.</value>
[XmlElement("current")]
[DataMember(Name = "current", Order = 4, EmitDefaultValue = false)]
public object Current { get; set; }

/// <summary>
/// Gets or sets the original value of the property.
/// </summary>
/// <value>The original value of the property.</value>
[XmlElement("original")]
[DataMember(Name = "original", Order = 5, EmitDefaultValue = false)]
public object Original { get; set; }
}
}
Loading