This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Linq; | |
using Nightingale.Entities; | |
namespace Nightingale.Sessions | |
{ | |
/// <summary> | |
/// Represents a graph node within the <see cref="SessionGraph"/>. | |
/// </summary> | |
public class SessionGraphNode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Nightingale.Entities; | |
namespace Nightingale.Sessions | |
{ | |
/// <summary> | |
/// Represents the session graph which contains the order of the entity hierarchy. | |
/// </summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SessionGraph : IEnumerable<Entity> | |
{ | |
/// <summary> | |
/// Gets the session graph nodes. | |
/// </summary> | |
public List<SessionGraphNode> Nodes { get; } | |
/// <summary> | |
/// Initializes a new SessionGraph class. | |
/// </summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Represents a graph node within the <see cref="SessionGraph"/>. | |
/// </summary> | |
public class SessionGraphNode | |
{ | |
/// <summary> | |
/// Gets the entity for this session graph node. | |
/// </summary> | |
public Entity Entity { get; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void TraverseSessionGraphNodes(List<SessionGraphNode> nodes, List<Entity> entities) | |
{ | |
foreach (var sessionGraphNode in nodes) | |
{ | |
TraverseSessionGraphNodes(sessionGraphNode.Nodes, entities); | |
entities.Add(sessionGraphNode.Entity); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<Entity Name="Address" Namespace="ConsoleApp1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../ThuCommix.EntityFramework/Entity.xsd"> | |
<Fields> | |
<Field Name="Person" FieldType="Person" Mandatory="true" Cascade="None" /> | |
<Field Name="IsValid" FieldType="bool" Mandatory="true" Cascade="None" /> | |
<Field Name="ValidFrom" FieldType="DateTime" Mandatory="true" DateOnly="true" Cascade="None" /> | |
<Field Name="ValidTo" FieldType="DateTime" Mandatory="false" DateOnly="false" Cascade="None" /> | |
<Field Name="Zip" FieldType="string" MaxLength="12" Mandatory="true" Cascade="None" /> | |
<Field Name="Town" FieldType="string" MaxLength="50" Mandatory="true" Cascade="None" /> | |
<Field Name="Street" FieldType="string" MaxLength="100" Mandatory="true" Cascade="None" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<Entity Name="Person" Namespace="ConsoleApp1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../ThuCommix.EntityFramework/Entity.xsd"> | |
<Fields> | |
<Field Name="FirstName" FieldType="string" Mandatory="true" MaxLength="50" Cascade="None" /> | |
<Field Name="Name" FieldType="string" Mandatory="true" MaxLength="50" Cascade="None" /> | |
<Field Name="Age" FieldType="int" Mandatory="false" Cascade="None" /> | |
<Field Name="IsLegalAge" FieldType="bool" Mandatory="false" Cascade="None" /> | |
</Fields> | |
<ListFields> | |
<ListField Name="Addresses" FieldType="Address" ReferenceField="Person" Cascade="SaveDelete" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void ReadHeader() | |
{ | |
var reader = new BinaryReader(_stream); | |
if (ReadChunk(reader) != "RIFF") | |
{ | |
throw new Exception("Invalid file format."); | |
} | |
reader.ReadInt32(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012-2015 Sharpex2D - Kevin Scholz (ThuCommix) | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the 'Software'), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012-2015 Sharpex2D - Kevin Scholz (ThuCommix) | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the 'Software'), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in |
NewerOlder