private SourcererConfigurator() { var assembliesInCallStack = new StackTrace().GetFrames() .Select(f => f.GetMethod()) .Select(m => m.DeclaringType.Assembly) .Distinct() .ToArray(); TypesProvider = new AssemblyScanningTypesProvider(assembliesInCallStack); FactStore = new MemoryFactStore(); Clock = new SystemClock(); DependencyResolver = new DefaultDependencyResolver(assembliesInCallStack); }
private static void Main(string[] args) { var factStoreDirectoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "TicketSeller"); var typesProvider = new AssemblyScanningTypesProvider(new[] {typeof (Program).Assembly}); var diskFactStore = new DiskFactStore(factStoreDirectoryPath, typesProvider); var sqlFactStore = SqlServerFactStore.Create(@"Server=.\SQLEXPRESS;Database=TicketSeller;Trusted_Connection=True;", typesProvider); _sourcererFactory = SourcererConfigurator.Configure() //.With(c => c.FactStore = new MemoryFactStore()) //.With(c => c.FactStore = diskFactStore) .With(c => c.FactStore = sqlFactStore) .Abracadabra(); var ticketSeller = new TicketSeller(); ticketSeller.SellABunchOfTickets(); Directory.Delete(factStoreDirectoryPath); }