-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factory for AzureTable Factory for CouchDb Factory for AppFabric cache Factory for WindowsAzure cache
- Loading branch information
Showing
67 changed files
with
722 additions
and
470 deletions.
There are no files selected for viewing
31 changes: 18 additions & 13 deletions
31
SharpRepository.AzureBlobRepository/SharpRepository.AzureBlobRepository.csproj
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
13 changes: 13 additions & 0 deletions
13
SharpRepository.AzureBlobRepository/repository.azureBlob.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"sharpRepository": { | ||
"repositories": { | ||
"default": "azureBlob", | ||
"azureBlob": { | ||
"factory": "SharpRepository.AzureBlobRepository.AzureBlobConfigRepositoryFactory, SharpRepository.AzureBlobRepository", | ||
"connectionString": "connectionStringOrName", | ||
"container": "containerName", | ||
"createIfNotExists": "true" | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
15 changes: 15 additions & 0 deletions
15
SharpRepository.AzureDocumentDb/repository.azureDocumentDb.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"sharpRepository": { | ||
"repositories": { | ||
"default": "azureDocumentDb", | ||
"azureDocumentDb": { | ||
"factory": "SharpRepository.AzureDocumentDbRepository.DocumentDbConfigRepositoryFactory, SharpRepository.AzureDocumentDbRepository", | ||
"endpointUrl": "https://example.com:443/", | ||
"authorizationKey": "DocumentDBSample", | ||
"databaseId": "Entertainment", | ||
"collectionId": "Games", | ||
"createIfNotExists": "true" | ||
} | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
SharpRepository.AzureTableRepository/AzureTableConfigRepositoryFactory.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using SharpRepository.Repository; | ||
using SharpRepository.Repository.Configuration; | ||
using Microsoft.WindowsAzure.Storage.Table; | ||
|
||
namespace SharpRepository.AzureTableRepository | ||
{ | ||
public class AzureTableConfigRepositoryFactory : ConfigRepositoryFactory | ||
{ | ||
public AzureTableConfigRepositoryFactory(IRepositoryConfiguration config) | ||
: base(config) | ||
{ | ||
} | ||
|
||
public override IRepository<T> GetInstance<T>() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override IRepository<T, TKey> GetInstance<T, TKey>() | ||
{ | ||
throw new NotImplementedException("azure table only implements ICompoundKeyRepository<T, string, string> using GetAzureTableInstanc"); | ||
} | ||
|
||
public override ICompoundKeyRepository<T> GetCompoundKeyInstance<T>() | ||
{ | ||
throw new NotImplementedException("azure table only implements ICompoundKeyRepository<T, string, string> using GetAzureTableInstance"); | ||
} | ||
|
||
public override ICompoundKeyRepository<T, TKey, TKey2, TKey3> GetInstance<T, TKey, TKey2, TKey3>() | ||
{ | ||
throw new NotImplementedException("azure table only implements ICompoundKeyRepository<T, TKey, TKey2>"); | ||
} | ||
|
||
public override ICompoundKeyRepository<T, TKey, TKey2> GetInstance<T, TKey, TKey2>() | ||
{ | ||
Boolean.TryParse(RepositoryConfiguration["createIfNotExists"], out bool createIfNotExists); | ||
|
||
return new AzureTableRepository<T, TKey, TKey2>(RepositoryConfiguration["connectionString"], RepositoryConfiguration["tableName"], createIfNotExists); | ||
} | ||
} | ||
} |
15 changes: 13 additions & 2 deletions
15
SharpRepository.AzureTableRepository/AzureTableRepository.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
using Microsoft.WindowsAzure.Storage.Table; | ||
using SharpRepository.Repository.Caching; | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace SharpRepository.AzureTableRepository | ||
{ | ||
public class AzureTableRepository<T> : AzureTableRepositoryBase<T> where T : class, ITableEntity, new() | ||
public class AzureTableRepository<T,TKey, TKey2> : AzureTableRepositoryBase<T, TKey, TKey2> where T : class, new() | ||
{ | ||
public AzureTableRepository(string connectionString, string tableName = null, bool createIfNotExists = true, ICompoundKeyCachingStrategy<T, string, string> cachingStrategy = null) | ||
public AzureTableRepository(string connectionString, string tableName = null, bool createIfNotExists = true, ICompoundKeyCachingStrategy<T, TKey, TKey2> cachingStrategy = null) | ||
: base(connectionString, tableName, createIfNotExists, cachingStrategy) | ||
{ | ||
if (typeof(TKey) != typeof(string) && typeof(TKey2) != typeof(string)) | ||
{ | ||
throw new Exception("Type of keys TKey and TKey2 musts be string"); | ||
} | ||
|
||
if (!typeof(T).GetTypeInfo().GetInterfaces().Contains(typeof(ITableEntity))) { | ||
throw new Exception("Type of T must implement ITableEntity"); | ||
} | ||
} | ||
} | ||
} |
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
43 changes: 43 additions & 0 deletions
43
SharpRepository.AzureTableRepository/AzureTableRepositoryConfiguration.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using SharpRepository.Repository.Configuration; | ||
|
||
namespace SharpRepository.AzureTableRepository | ||
{ | ||
public class AzureTableRepositoryConfiguration : RepositoryConfiguration | ||
{ | ||
public AzureTableRepositoryConfiguration(string name) : this(name, null, null) | ||
{ | ||
} | ||
|
||
public AzureTableRepositoryConfiguration(string name, string connectionString) | ||
: this(name, connectionString, null) | ||
{ | ||
} | ||
|
||
public AzureTableRepositoryConfiguration(string name, string connectionString, string tableName, bool createIfNotExists = false, string cachingStrategy = null, string cachingProvider = null) | ||
: base(name) | ||
{ | ||
ConnectionString = connectionString; | ||
TableName = tableName; | ||
CreateIfNotExists = createIfNotExists; | ||
CachingStrategy = cachingStrategy; | ||
CachingProvider = cachingProvider; | ||
Factory = typeof(AzureTableConfigRepositoryFactory); | ||
} | ||
|
||
public string ConnectionString | ||
{ | ||
set { Attributes["connectionString"] = value; } | ||
} | ||
|
||
public string TableName | ||
{ | ||
set { Attributes["tableName"] = String.IsNullOrEmpty(value) ? null : value; } | ||
} | ||
|
||
public bool CreateIfNotExists | ||
{ | ||
set { Attributes["createIfNotExists"] = value.ToString(); } | ||
} | ||
} | ||
} |
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
12 changes: 12 additions & 0 deletions
12
SharpRepository.AzureTableRepository/repository.azureTable.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"sharpRepository": { | ||
"repositories": { | ||
"default": "azureTable", | ||
"azureTable": { | ||
"factory": "SharpRepository.AzureTable.AzureTableConfigRepositoryFactory, SharpRepository.AzureTable", | ||
"connectionString": "ArzureTableConnectionString", | ||
"tableName": "tableName" | ||
} | ||
} | ||
} | ||
} |
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
9 changes: 0 additions & 9 deletions
9
SharpRepository.CacheRepository/_nuget/content/config.transform
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.