This file contains hidden or 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 void RegisterTypes(IUnityContainer container) | |
| { | |
| container.RegisterType<IRepository>(new InjectionFactory(context => new EventStoreRepository(context.Resolve<IStoreEvents>(), new AggregateFactory(), new ConflictDetector()))); | |
| container.RegisterType<IMediator>(new InjectionFactory(x => new Mediator(() => new UnityServiceLocator(x)))); | |
| container.RegisterTypes(AllClasses.FromAssemblies(typeof(Commands.InventoryCommandHandler).Assembly), WithMappings.FromAllInterfaces, GetName, GetLifetimeManager); | |
| container.RegisterTypes(AllClasses.FromAssemblies(typeof(Queries.InventoryQueryHandler).Assembly), WithMappings.FromAllInterfaces, GetName, GetLifetimeManager); | |
| container.RegisterType<IStoreEvents>(new InjectionFactory(context => Wireup.Init() | |
| .UsingSqlPersistence("EventStore") | |
| .WithDialect(new MySqlDialect()) | |
| .EnlistInAmbientTransaction() |
This file contains hidden or 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
| container.RegisterType<IMediator>(new InjectionFactory(x => new Mediator(() => new UnityServiceLocator(x)))); |
This file contains hidden or 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 Mediator(ServiceLocatorProvider serviceLocatorProvider); |
This file contains hidden or 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.Threading.Tasks; | |
| namespace dcomartin.Demo.AsyncAwaitExceptions | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| // Since main entry does not support async, lets create a async task. |
This file contains hidden or 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
| Add("sendErrorEmails", true); | |
| Add("errorEmail", "[email protected]"); |
This file contains hidden or 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
| var sendErrorEmails = Config.Global.Get<bool>("sendErrorEmails"); | |
| var errorEmail = Config.Global.Get<string>("errorEmail"); |
This file contains hidden or 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
| // Load from file system | |
| Config.Global.LoadScriptFile("path/to/MyConfig.csx"); | |
| // Load from web | |
| Config.Global.LoadWebScript(new Uri("https://www.domain.com/MyConfig.csx")); |
This file contains hidden or 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 AnotherProject | |
| { | |
| public class ErrorConfig | |
| { | |
| public bool SendEmails { get; set; } | |
| public string Email { get; set; } | |
| } | |
| } |
This file contains hidden or 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
| #r bin/AnotherProject.dll | |
| using AnotherProject; | |
| Add("error", new ErrorConfig { SendEmails = true, Email = "[email protected]" }); | |
| Add("sendErrorEmails", true); | |
| Add("errorEmail", "[email protected]"); |
This file contains hidden or 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
| var errorConfig = Config.Global.Get<ErrorConfig>("error"); |
OlderNewer