View DatabaseDeleter.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
using System; | |
using System.Collections.Generic; | |
using System.Data.Entity; | |
using System.Linq; | |
public class DatabaseDeleter | |
{ | |
static readonly string[] _ignoredTables = | |
{ | |
"sysdiagrams", |
View ElasticSearchIntegrationTestSetupFixture.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
using System; | |
using NUnit.Framework; | |
using Search.QueryUnderstanding.Api.Application; | |
[SetUpFixture] | |
public class ElasticSearchIntegrationTestSetupFixture | |
{ | |
private readonly ElasticSearchTestClient client = new ElasticSearchTestClient(new ElasticSearchConfiguration()); | |
private readonly ElasticSearchTestContext context = new ElasticSearchTestContext(); |
View Disable-NServiceBusSetupCheck.ps1
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
function global:Disable-NServiceBusSetupCheck() | |
{ | |
#default to current dir when debugging | |
if(!$solutionScriptsContainer){ | |
$solutionScriptsContainer = "./" | |
} | |
$packagesFolder = Join-Path $solutionScriptsContainer "..\packages" -Resolve | |
Push-Location $packagesFolder |
View gist:140174
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 AutoMapperConfiguration | |
{ | |
public static void Configure() | |
{ | |
Mapper.Initialize(x => x.AddProfile<ViewModelProfile>()); | |
} | |
} | |
public class ViewModelProfile : Profile | |
{ |
View gist:140166
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 MapAllPersistentObjects() | |
{ | |
var openType = typeof(IdToEntityConverter<>); | |
var guidType = typeof(Guid); | |
var allPersistentObjects = | |
from t in typeof(Customer).Assembly.GetTypes() | |
where typeof(Entity).IsAssignableFrom(t) | |
let converterType = openType.MakeGenericType(t) | |
select new {EntityType = t, ConverterType = converterType}; |
View gist:161389
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 static bool IsSubclassOfOpenGeneric(this Type type, Type generic) | |
{ | |
while (type != typeof(object)) | |
{ | |
var current = type.IsGenericType ? type.GetGenericTypeDefinition() : type; | |
if (generic == current) | |
{ | |
return true; | |
} | |
type = type.BaseType; |
View gist:192943
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 interface IRepository | |
{ | |
void Save<ENTITY>(ENTITY entity) | |
where ENTITY : DomainEntity; | |
ENTITY Load<ENTITY>(Guid id) | |
where ENTITY : DomainEntity; | |
IQueryable<ENTITY> Query<ENTITY>() | |
where ENTITY : DomainEntity; |
View gist:192948
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 interface IOrderRepository : IRepository<Order> | |
{ | |
Order[] GetAllOrderForCustomer(Customer customer); | |
int GetCountOfOrdersForCustomer(Customer customer); | |
bool HasOpenOrders(Customer customer); | |
Order[] GetAllOpenOrders(Customer customer); | |
Order[] GetOrdersHavingRefunds(Customer customer); | |
Order[] GetOrdersWithFundsAvailableForRefund(Customer customer); | |
Order[] GetAllSignificantOrderForCustomer(Customer customer); | |
Order[] GetBySearchCriteria(IOrderCriteria criteria); |
View gist:192947
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 interface IOrderRepository : IRepository<Order> | |
{ | |
Order[] GetAllOrderForCustomer(Customer customer); | |
int GetCountOfOrdersForCustomer(Customer customer); | |
bool HasOpenOrders(Customer customer); | |
Order[] GetAllOpenOrders(Customer customer); | |
Order[] GetOrdersHavingRefunds(Customer customer); | |
Order[] GetOrdersWithFundsAvailableForRefund(Customer customer); | |
Order[] GetAllSignificantOrderForCustomer(Customer customer); | |
Order[] GetBySearchCriteria(IOrderCriteria criteria); |
View gist:205003
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 BaseReportPage<TModel> : BaseViewPage<TModel>, IViewBase where TModel : class | |
{ | |
// ... | |
protected override void OnPreInit(EventArgs e) | |
{ | |
if (ShowAsPdf) | |
{ | |
string path = _configuration.GetPrincePath(); | |
var prince = new Prince(path); |
OlderNewer