public bool Update(ServerPartition partition, List <string> groupsWithDataAccess) { using (IUpdateContext context = PersistentStore.OpenUpdateContext(UpdateContextSyncMode.Flush)) { var parms = new ServerPartitionUpdateColumns { AeTitle = partition.AeTitle, Description = partition.Description, Enabled = partition.Enabled, PartitionFolder = partition.PartitionFolder, Port = partition.Port, AcceptAnyDevice = partition.AcceptAnyDevice, AutoInsertDevice = partition.AutoInsertDevice, DefaultRemotePort = partition.DefaultRemotePort, DuplicateSopPolicyEnum = partition.DuplicateSopPolicyEnum, MatchPatientsName = partition.MatchPatientsName, MatchPatientId = partition.MatchPatientId, MatchPatientsBirthDate = partition.MatchPatientsBirthDate, MatchAccessionNumber = partition.MatchAccessionNumber, MatchIssuerOfPatientId = partition.MatchIssuerOfPatientId, MatchPatientsSex = partition.MatchPatientsSex, AuditDeleteStudy = partition.AuditDeleteStudy, AcceptLatestReport = partition.AcceptLatestReport }; var broker = context.GetBroker <IServerPartitionEntityBroker>(); if (!broker.Update(partition.Key, parms)) { return(false); } UpdateDataAccess(context, partition, groupsWithDataAccess); context.Commit(); return(true); } }
private Table GetTableForEnumClass(Type enumClass, PersistentStore store) { PersistentClass pclass = CollectionUtils.SelectFirst<PersistentClass>(store.Configuration.ClassMappings, delegate(PersistentClass c) { return c.MappedClass == enumClass; }); if (pclass == null) throw new Exception(string.Format("{0} is not a persistent class", enumClass.FullName)); return pclass.Table; }
public SettingsDictionary(PersistentStore store, string settingName) { Store = store; SettingName = settingName; }
public SettingsList(PersistentStore store, string settingName) : this(store, settingName, null) { }
public DefaultPluginSettings(PersistentStore store) { Store = store; }
/// <summary> /// Constructor that creates a model from all NHibernate mappings and embedded enumeration information /// in the set of installed plugins. /// </summary> public RelationalModelInfo(PersistentStore store, RelationalSchemaOptions.NamespaceFilterOption namespaceFilter) : this(store.Configuration, namespaceFilter) { }
private PersistentStore GetStore() { var store = new PersistentStore(_repository, _textProcessor); return(store); }
/// <summary> /// Constructor. /// </summary> /// <param name="settings">The Persistent Store for this object.</param> public ManagerSettings(PersistentStore store) { Store = store; }
static int Main(string[] args) { Configuration configuration = null; try { configuration = Configuration.Load(); } catch { Console.WriteLine("The configuration.json file could not be read. Please ensure that it is present in\n\n {1}\n\nand has the following schema:\n\n{0}\n", Configuration.Schema, Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)); Console.Write("Press any key to exit..."); Console.ReadKey(); return(-1); } string remoteString; if (args.Length < 1 || args[0] == "/ask") { // A debugger string wasn't specified. Prompt for a debug string instead. Console.WriteLine("You can run the following command to create a remote debugging server in WinDbg: '.server npipe:pipe=jsdbg'"); Console.Write("Please specify a debug remote string (e.g. npipe:Pipe=foo,Server=bar):"); remoteString = Console.ReadLine().Trim(); if (remoteString.StartsWith("-remote ")) { remoteString = remoteString.Substring("-remote ".Length).Trim(); } if (remoteString.Length == 0) { return(-1); } } else { remoteString = args[0]; } DebuggerRunner runner; try { Console.Write("Connecting to a debug session at {0}...", remoteString); runner = new DebuggerRunner(remoteString); Console.WriteLine("Connected."); } catch (Exception ex) { Console.WriteLine("Failed: {0}", ex.Message); Console.Write("Press any key to exit..."); Console.ReadKey(); return(-1); } PersistentStore persistentStore = new PersistentStore(); using (WebServer webServer = new WebServer(runner.Debugger, persistentStore, configuration.ExtensionRoot)) { webServer.LoadExtension("default"); SynchronizationContext previousContext = SynchronizationContext.Current; try { SingleThreadSynchronizationContext syncContext = new SingleThreadSynchronizationContext(); SynchronizationContext.SetSynchronizationContext(syncContext); // Run the debugger. If the debugger ends, kill the web server. runner.Run().ContinueWith((Task result) => { webServer.Abort(); }); // The web server ending kills the debugger and completes our SynchronizationContext which allows us to exit. webServer.Listen().ContinueWith(async(Task result) => { await runner.Shutdown(); await Task.Delay(500); syncContext.Complete(); }); JsDbg.Remoting.RemotingServer.RegisterNewInstance(remoteString, () => { BrowserLauncher.Launch(webServer.Url); }); BrowserLauncher.Launch(webServer.Url); // Pressing ctrl-c kills the web server. Task.Run(() => ReadKeysUntilAbort(webServer.Url)).ContinueWith((Task result) => { Console.WriteLine("Shutting down..."); webServer.Abort(); }); // Process requests until the web server is taken down. syncContext.RunOnCurrentThread(); } catch (Exception ex) { Console.WriteLine("Shutting down due to exception: {0}", ex.Message); } finally { SynchronizationContext.SetSynchronizationContext(previousContext); } } return(0); }
/// <summary> /// Processes the specified persistent store. /// </summary> /// <param name="store"></param> public void Process(PersistentStore store) { Process(store.Configuration); }
static PathingBehavior() { _behaviorStore = GameService.Pathing.PathingStore.GetSubstore(PATHINGBEHAVIOR_STORENAME); AllAvailableBehaviors = IdentifyingBehaviorAttributePrefixAttribute.GetTypes(System.Reflection.Assembly.GetExecutingAssembly()).ToList(); }
/// <summary> /// Configures the specified application. /// </summary> /// <param name="app">The application.</param> /// <param name="env">The env.</param> /// <param name="dataContext">The data context.</param> public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DatabaseContext dataContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } try { dataContext.Database.Migrate(); } catch (Exception e) { Console.WriteLine(e); throw; } //appLifetime.ApplicationStopped.Register(() => //{ // Console.WriteLine("Shutting down..."); // System.Diagnostics.Process.GetCurrentProcess().Kill(); //}); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapControllerRoute("defaultError", "{controller=Error}/{action=Error}"); endpoints.MapControllers(); endpoints.MapFallback(ctx => { ctx.Response.Redirect("/home/redirect" + ctx.Request.Path); return(Task.CompletedTask); }); }); using (var serviceScope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope()) { var _memoryCache = serviceScope.ServiceProvider.GetRequiredService <IMemoryCache>(); // var _DbCache = serviceScope.ServiceProvider.GetRequiredService<ILiteDatabase>(); var _allRepository = serviceScope.ServiceProvider.GetRequiredService <IAllPageURLRepository>(); var _pageUrlRepository = serviceScope.ServiceProvider.GetRequiredService <IPageURLRepository>(); // var allitems= DBcontext.PageUrlMaster.ToList(); var style = Configuration.GetValue <RestoreStoreStyleEnum>("PersistentReStore"); PersistentStore.Load(_memoryCache, _allRepository, _pageUrlRepository, style); } }