/// <summary> /// Constructor /// </summary> public MemoryStorage() { Person = new CrudMemory <PersonTable, Guid>(); Consent = new CrudMemory <ConsentTable, Guid>(); Address = new ManyToOneMemory <AddressTable, Guid>(item => item.PersonId); PersonConsent = new ManyToManyMemory <PersonConsentTable, PersonTable, ConsentTable, Guid>(item => item.PersonId, item => item.ConsentId, Person, Consent); }
/// <summary> /// Constructor /// </summary> public SqlServerStorage(string connectionString) { // Person var tableMetadata = new SqlTableMetadata { TableName = "Person", CustomColumnNames = new [] { "Name" }, OrderBy = new [] { "Name" }, EtagColumnName = "Etag", }; var person = new CrudSql <PersonTable>(connectionString, tableMetadata); Person = person; // Consent tableMetadata = new SqlTableMetadata { TableName = "Consent", CustomColumnNames = new[] { "Name" }, OrderBy = new[] { "Name" }, EtagColumnName = "Etag", }; var consent = new CrudSql <ConsentTable>(connectionString, tableMetadata); Consent = consent; // Address tableMetadata = new SqlTableMetadata { TableName = "Address", CustomColumnNames = new[] { "Type", "Street", "City", "PersonId" }, OrderBy = new[] { "Type" }, EtagColumnName = "Etag", ForeignKeyColumnName = "PersonId" }; Address = new ManyToOneSql <AddressTable, PersonTable>(connectionString, tableMetadata, "PersonId", person); // PersonConsent tableMetadata = new SqlTableMetadata { TableName = "PersonConsent", CustomColumnNames = new[] { "HasGivenConsent", "PersonId", "ConsentId" }, OrderBy = new string[] { }, EtagColumnName = "Etag", ForeignKeyColumnName = "PersonId" }; PersonConsent = new ManyToManySql <PersonConsentTable, PersonTable, ConsentTable>(connectionString, tableMetadata, "PersonId", person, "ConsentId", consent); }