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 UserModel | |
{ | |
public virtual CategoryModel Category { get; set; } | |
public virtual UserGroupModel Group { get; set; } | |
} | |
public class CategoryModel | |
{ | |
public CategoryModel Category { get; set; } | |
} |
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
void Main() | |
{ | |
var configurationStore = new ConfigurationStore(new TypeMapFactory(), MapperRegistry.Mappers); | |
var mapper = new MappingEngine(configurationStore); | |
var server = new Server(); | |
configurationStore | |
.CreateMap<From, To>() | |
.ForMember(d => d.ServerThing, m => m.MapFrom(s => s.ServerThingId)) |
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
internal static class AsyncHelper { | |
private static readonly TaskFactory taskFactory = new TaskFactory(CancellationToken.None, TaskCreationOptions.None, TaskContinuationOptions.None, TaskScheduler.Default); | |
public static TResult RunSync<TResult>(this Func<Task<TResult>> func) { | |
return taskFactory.StartNew(func).Unwrap().GetAwaiter().GetResult(); | |
} | |
public static void RunSync(this Func<Task> func) { | |
taskFactory.StartNew(func).Unwrap().GetAwaiter().GetResult(); | |
} |
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
namespace Accounts | |
{ | |
namespace NewAccounts | |
{ | |
public class When_creating_a_new_account { | |
Account account = new Account(); | |
public void Does_not_have_any_subscriptions() { | |
account.Subscriptions.Count.ShouldEqual(0); | |
} |
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 DatabaseDeleter | |
{ | |
private readonly ISessionFactory _configuration; | |
private static readonly string[] _ignoredTables = new[] { "sysdiagrams", /* DB Migration tables too */ }; | |
private static string[] _tablesToDelete; | |
private static string _deleteSql; | |
private static object _lockObj = new object(); | |
private static bool _initialized; | |
public DatabaseDeleter(ISessionFactory sessionSource) |