static void Main(string[] args) { Console.WriteLine("Hello World!"); var serviceProvider = ConfigureServices(); PersistenceProvider = serviceProvider.GetRequiredService <IPersistenceProvider>(); IWorkflowHost host = serviceProvider.GetService <IWorkflowHost>(); host.RegisterWorkflow <MySagaWorkflow, MySagaData>(); //host.RegisterWorkflow<MySagaWorkflow>(); // To do withput the MySagaData class host.Start(); var data = new MySagaData { boo = "boo", SpanishGreet = "¡Hola, mundo!", EnglishGreet = "Hello, World!", FrenchGreet = "Salut, monde!", GermanGreet = "Hallo, Welt!", RussianGreet = ".____.", }; var workflowId = host.StartWorkflow <MySagaData>("PablosSagaPattern", data).Result; // Console.ReadKey(); // This wait the user to press enter. var remainingTime = TimeSpan.FromSeconds(5); WaitForWorkflowToComplete(workflowId, remainingTime); host.Stop(); }
private void SaveObjectPrivate(PersistentObject obj, ClassMap cm, IPersistenceProvider rdb) { IDbCommand cmd; if (obj.IsPersistent) { cmd = cm.GetUpdateSqlFor(obj); if (rdb.DoCommand(cmd) < 1) { Assert.Fail(Error.ObjectUpdateFail, obj.GetClassName() + "Object update failed!"); } } else { cmd = cm.GetInsertSqlFor(obj); if (cm.Table.AutoIdentityIndex < 0) { rdb.DoCommand(cmd); } else { object id; rdb.InsertRecord(cmd, out id); obj.SetAttributeValue(cm.AutoIdentityAttribute, id); } } }
public static void MyClassInitialize(TestContext testContext) { AutoFacResolver.InitialiseFoundation(); var instance = DependencyResolver.Current.Resolve<IFoundationConfigurationSection>(); _provider = DependencyResolver.Current.Resolve<IPersistenceProvider>("nhibernate-01"); }
protected void RegisterPersistenceProvider(IPersistenceProvider provider) { var manager = new Mock <IPersistenceProviderManager>(); manager.Expect(m => m.GetProvider()).Returns(provider); this.AppContext.Factory.Register(manager.Object); }
#pragma warning restore 0414 public ReversalIndexEntryFormSlice(LcmCache cache, string editor, int flid, XmlNode node, ICmObject obj, IPersistenceProvider persistenceProvider, int ws) : base(obj, flid, WritingSystemServices.kwsAllReversalIndex, 0, false, true, true) { m_configNode = node; m_persistProvider = persistenceProvider; }
public WorkflowsController(IWorkflowController workflowService, ISearchIndex searchService, IWorkflowRegistry registry, IPersistenceProvider workflowStore) { _workflowService = workflowService; _workflowStore = workflowStore; _registry = registry; _searchService = searchService; }
public WorkflowsController(IWorkflowHost workflowHost, IWorkflowRegistry registry, IPersistenceProvider workflowStore, ILoggerFactory loggerFactory) { _workflowHost = workflowHost; _workflowStore = workflowStore; _registry = registry; _logger = loggerFactory.CreateLogger <WorkflowsController>(); }
public void AddDataSource(string dbName, string dbType, string connectionString) { if (m_DatabasePool.Contains(dbName)) { m_DatabasePool.Remove(dbName); } IPersistenceProvider rdb = null; try { string dbClassName = ContextManager.GetDbClassName(dbType); rdb = (IPersistenceProvider)this.GetType().Assembly.CreateInstance(dbClassName); } catch { Assert.Fail(Error.DatabaseConnectError, "Create a data source" + dbName + "failed"); } rdb.Name = dbName; rdb.Initialize(connectionString); if (rdb != null) { m_DatabasePool.Add(rdb.Name, rdb); } }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="ReferenceSlice"/> class. /// </summary> /// ----------------------------------------------------------------------------------- public ReferenceSlice(FdoCache cache, ICmObject obj, int flid, XmlNode configurationNode, IPersistenceProvider persistenceProvider, Mediator mediator, StringTable stringTbl) : base(null, cache, obj, flid) { ConfigurationNode = configurationNode; //todo: remove this when FieldSlice gets the node as part of its constructor // have chooser title use the same text as the label if (mediator != null && mediator.HasStringTable) { m_fieldName = XmlUtils.GetLocalizedAttributeValue(mediator.StringTbl, configurationNode, "label", m_fieldName); } else if (stringTbl != null) { m_fieldName = XmlUtils.GetLocalizedAttributeValue(stringTbl, configurationNode, "label", m_fieldName); } else { m_fieldName = XmlUtils.GetOptionalAttributeValue( configurationNode, "label", m_fieldName); } SetupControls(persistenceProvider, mediator, stringTbl); }
/// <summary> /// We want the persistence provider, and the easiest way to get it is to get all /// this other stuff we don't need or use. /// </summary> /// <param name="cache"></param> /// <param name="editor"></param> /// <param name="flid"></param> /// <param name="node"></param> /// <param name="obj"></param> /// <param name="stringTbl"></param> /// <param name="persistenceProvider"></param> /// <param name="ws"></param> public PhEnvStrRepresentationSlice(FdoCache cache, string editor, int flid, System.Xml.XmlNode node, ICmObject obj, StringTable stringTbl, IPersistenceProvider persistenceProvider, int ws) : base(new StringRepSliceView(obj.Hvo), obj, StringRepSliceVc.Flid) { m_persistenceProvider = persistenceProvider; }
/// <inheritdoc/> public void RequirePersistence <TFeature>(IServiceCollection services, string persistenceProviderImplementation = null) where TFeature : IFullNodeFeature { if (persistenceProviderImplementation == null) { persistenceProviderImplementation = this.nodeSettings.DbType ?? this.GetDefaultProvider(); } IPersistenceProvider provider = null; if (this.persistenceProviders.TryGetValue(persistenceProviderImplementation.ToLowerInvariant(), out List <IPersistenceProvider> providersList)) { provider = providersList.FirstOrDefault(provider => provider.FeatureType == typeof(TFeature)); if (provider == null) { throw new NodeBuilderException($"Required persistence provider {persistenceProviderImplementation} doesn't implement persistence for {typeof(TFeature).Name}."); } provider.AddRequiredServices(services); } else { throw new NodeBuilderException($"Required persistence provider implementation {persistenceProviderImplementation} Not found."); } }
public bool RetrieveObject(PersistentObject obj, Transaction transaction) { ClassMap clsMap = GetClassMap(obj.GetClassName()); IPersistenceProvider rdb = transaction.GetPersistenceProvider(clsMap.Database.Name); return(RetrieveObjectPrivate(obj, clsMap, rdb)); }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected virtual void Dispose(bool disposing) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); // Must not be run more than once. if (m_isDisposed) { return; } if (disposing) { // Dispose managed resources here. if (m_mediator != null) { m_mediator.RemoveColleague(this); } if (m_persistProvider != null && (m_persistProvider is IDisposable)) { (m_persistProvider as IDisposable).Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_mediator = null; m_configurationParameters = null; m_persistProvider = null; m_isDisposed = true; }
public static DataTable ProcessStoredProc(string storeProcName, IDataParameter[] param, string dbName, Transaction transaction) { IPersistenceProvider rdb = transaction.GetPersistenceProvider(dbName); IDbCommand cmd = Query.StoredProcCommand(storeProcName, param, dbName, transaction); return(rdb.AsDataTable(cmd)); }
/// <summary> /// /// </summary> /// <param name="persistenceProvider"></param> /// <param name="stringTbl"></param> protected override void SetupControls(IPersistenceProvider persistenceProvider, Mediator mediator, StringTable stringTbl) { AtomicReferenceLauncher arl = new AtomicReferenceLauncher(); arl.Initialize(m_cache, m_obj, m_flid, m_fieldName, persistenceProvider, mediator, DisplayNameProperty, BestWsName); // TODO: Get better default 'best ws'. arl.ConfigurationNode = ConfigurationNode; XmlNode deParams = ConfigurationNode.SelectSingleNode("deParams"); if (XmlUtils.GetOptionalBooleanAttributeValue( deParams, "changeRequiresRefresh", false)) { arl.ChoicesMade += new EventHandler(this.RefreshTree); } // We don't want to be visible until later, since otherwise we get a temporary // display in the wrong place with the wrong size that serves only to annoy the // user. See LT-1518 "The drawing of the DataTree for Lexicon/Advanced Edit draws // some initial invalid controls." Becoming visible when we set the width and // height seems to delay things enough to avoid this visual clutter. arl.Visible = false; this.Control = arl; arl.ViewSizeChanged += new FwViewSizeChangedEventHandler(this.OnViewSizeChanged); AtomicReferenceView view = (AtomicReferenceView)arl.MainControl; view.ViewSizeChanged += new FwViewSizeChangedEventHandler(this.OnViewSizeChanged); }
public Store(IConfiguration configuration) { _configuration = configuration; _persistenceProvider = _configuration.BuildProvider(); _currentConversation = _configuration.BuildValueStore(); _createSessionAndTransactionManager = _configuration.CreateSessionAndTransactionManager; }
public DataTable ExecuteQuery(IDbCommand cmd, string rdbName) { IPersistenceProvider rdb = null; if (rdbName == "") { rdb = GetDatabase().GetCopy(); } else { rdb = GetDatabase(rdbName).GetCopy(); } try { rdb.Open(); DataTable dt = rdb.AsDataTable(cmd); return(dt); } catch (Exception ex) { this.ErrorHandle(ex, null, cmd.CommandText.ToString()); } finally { rdb.Close(); } return(null); }
public ActionModel(ILoggerFactory loggerFactory, IPersistenceProvider persistenceProvider, FcmMessageHandler fcmMessageHandler, IAmqpService amqpService) : base(loggerFactory) { _persistenceProvider = persistenceProvider; _fcmMessageHandler = fcmMessageHandler; _amqpService = amqpService; }
public ValueHandler(ILoggerFactory loggerFactory, IPersistenceProvider persistanceProvider, IAmqpService amqpService) : base(loggerFactory) { _logger = loggerFactory.CreateLogger <ValueHandler>(); _persistanceProvider = persistanceProvider; _amqpService = amqpService; }
public JobModel(ILoggerFactory loggerFactory, MessageHandler messageHandler, ConfigHandler configHandler, IPersistenceProvider persistenceProvider) : base(loggerFactory) { _messageHandler = messageHandler; _configHandler = configHandler; _persistenceProvider = persistenceProvider; }
public EventConsumer(IPersistenceProvider persistenceStore, IQueueProvider queueProvider, ILoggerFactory loggerFactory, IServiceProvider serviceProvider, IWorkflowRegistry registry, IDistributedLockProvider lockProvider, WorkflowOptions options, IDateTimeProvider datetimeProvider) : base(queueProvider, loggerFactory, options) { _persistenceStore = persistenceStore; _lockProvider = lockProvider; _datetimeProvider = datetimeProvider; }
public WorkflowExecutorFixture() { Host = A.Fake <IWorkflowHost>(); PersistenceProvider = A.Fake <IPersistenceProvider>(); ServiceProvider = A.Fake <IServiceProvider>(); ScopeProvider = A.Fake <IScopeProvider>(); Registry = A.Fake <IWorkflowRegistry>(); ResultProcesser = A.Fake <IExecutionResultProcessor>(); EventHub = A.Fake <ILifeCycleEventPublisher>(); CancellationProcessor = A.Fake <ICancellationProcessor>(); DateTimeProvider = A.Fake <IDateTimeProvider>(); Options = new WorkflowOptions(A.Fake <IServiceCollection>()); var scope = A.Fake <IServiceScope>(); A.CallTo(() => ScopeProvider.CreateScope(A <IStepExecutionContext> ._)).Returns(scope); A.CallTo(() => scope.ServiceProvider).Returns(ServiceProvider); A.CallTo(() => DateTimeProvider.Now).Returns(DateTime.Now); A.CallTo(() => DateTimeProvider.UtcNow).Returns(DateTime.UtcNow); //config logging var loggerFactory = new LoggerFactory(); //loggerFactory.AddConsole(LogLevel.Debug); Subject = new WorkflowExecutor(Registry, ServiceProvider, ScopeProvider, DateTimeProvider, ResultProcesser, EventHub, CancellationProcessor, Options, loggerFactory); }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { // Dispose managed resources here. if (m_combo != null) { m_combo.SelectedIndexChanged -= new EventHandler(SelectionChanged); Control.Controls.Remove(m_combo); m_combo.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_combo = null; m_mediator = null; m_persistProvider = null; base.Dispose(disposing); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructor. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="obj">CmObject that is being displayed.</param> /// <param name="flid">The field identifier for the attribute we are displaying.</param> /// <param name="persistenceProvider">The persistence provider.</param> /// ------------------------------------------------------------------------------------ public MSAReferenceComboBoxSlice(FdoCache cache, ICmObject obj, int flid, IPersistenceProvider persistenceProvider) : base(new UserControl(), cache, obj, flid) { IWritingSystem defAnalWs = m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem; m_persistProvider = persistenceProvider; m_tree = new TreeCombo(); m_tree.WritingSystemFactory = cache.WritingSystemFactory; m_tree.Font = new System.Drawing.Font(defAnalWs.DefaultFontName, 10); if (!Application.RenderWithVisualStyles) m_tree.HasBorder = false; m_tree.WritingSystemCode = defAnalWs.Handle; // We embed the tree combo in a layer of UserControl, so it can have a fixed width // while the parent window control is, as usual, docked 'fill' to work with the splitter. m_tree.Dock = DockStyle.Left; m_tree.Width = 240; m_tree.DropDown += m_tree_DropDown; Control.Controls.Add(m_tree); m_tree.SizeChanged += m_tree_SizeChanged; if (m_cache != null) m_cache.DomainDataByFlid.AddNotification(this); m_treeBaseWidth = m_tree.Width; // m_tree has sensible PreferredHeight once the text is set, UserControl does not. //we need to set the Height after m_tree.Text has a value set to it. Control.Height = m_tree.PreferredHeight; }
public WorkflowExecutorFixture() { //setup dependency injection IServiceCollection services = new ServiceCollection(); services.AddLogging(); //TODO: mock these dependencies to make true unit tests Options = new WorkflowOptions(); services.AddSingleton(Options); services.AddTransient <IWorkflowBuilder, WorkflowBuilder>(); services.AddTransient <IWorkflowRegistry, WorkflowRegistry>(); services.AddTransient <IExecutionResultProcessor, ExecutionResultProcessor>(); services.AddTransient <IExecutionPointerFactory, ExecutionPointerFactory>(); services.AddTransient <IDateTimeProvider, DateTimeProvider>(); Host = A.Fake <IWorkflowHost>(); PersistenceProvider = A.Fake <IPersistenceProvider>(); var serviceProvider = services.BuildServiceProvider(); //config logging var loggerFactory = serviceProvider.GetService <ILoggerFactory>(); loggerFactory.AddConsole(LogLevel.Debug); Registry = serviceProvider.GetService <IWorkflowRegistry>(); ResultProcesser = serviceProvider.GetService <IExecutionResultProcessor>(); Subject = new WorkflowExecutor(Registry, serviceProvider, new DateTimeProvider(), ResultProcesser, Options, loggerFactory); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged /// resources; <c>false</c> to release only unmanaged resources. /// </param> /// ----------------------------------------------------------------------------------- protected override void Dispose(bool disposing) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { if (components != null) { components.Dispose(); } if (m_mainControl != null && m_mainControl.Parent == null) { m_mainControl.Dispose(); } } m_fieldName = null; m_cache = null; m_obj = null; m_persistProvider = null; m_mediator = null; m_configurationNode = null; m_mainControl = null; m_panel = null; m_btnLauncher = null; m_displayNameProperty = null; base.Dispose(disposing); }
/// <summary> /// We want the persistence provider, and the easiest way to get it is to get all /// this other stuff we don't need or use. /// </summary> /// <param name="cache"></param> /// <param name="editor"></param> /// <param name="flid"></param> /// <param name="node"></param> /// <param name="obj"></param> /// <param name="stringTbl"></param> /// <param name="persistenceProvider"></param> /// <param name="ws"></param> public PhEnvStrRepresentationSlice(FdoCache cache, string editor, int flid, System.Xml.XmlNode node, ICmObject obj, StringTable stringTbl, IPersistenceProvider persistenceProvider, int ws) : base(new StringRepSliceView(obj.Hvo), obj, StringRepSliceVc.Flid) { m_persistenceProvider = persistenceProvider; }
public void SaveObject(PersistentObject obj, Transaction transaction) { ClassMap clsMap = GetClassMap(obj.GetClassName()); IPersistenceProvider rdb = transaction.GetPersistenceProvider(clsMap.Database.Name); SaveObjectPrivate(obj, clsMap, rdb); }
protected virtual void Setup(bool registerClassMap = false) { //setup dependency injection IServiceCollection services = new ServiceCollection(); services.AddLogging(); ConfigureServices(services); var serviceProvider = services.BuildServiceProvider(); //config logging var loggerFactory = serviceProvider.GetService <ILoggerFactory>(); //loggerFactory.AddConsole(LogLevel.Debug); if (registerClassMap && !BsonClassMap.IsClassMapRegistered(typeof(TData))) { BsonClassMap.RegisterClassMap <TData>(map => map.AutoMap()); } PersistenceProvider = serviceProvider.GetService <IPersistenceProvider>(); Host = serviceProvider.GetService <IWorkflowHost>(); Host.RegisterWorkflow <TWorkflow, TData>(); Host.OnStepError += Host_OnStepError; Host.Start(); }
public WorkflowExecutorFixture() { Host = A.Fake <IWorkflowHost>(); PersistenceProvider = A.Fake <IPersistenceProvider>(); ServiceProvider = A.Fake <IServiceProvider>(); ScopeProvider = A.Fake <IScopeProvider>(); Registry = A.Fake <IWorkflowRegistry>(); ResultProcesser = A.Fake <IExecutionResultProcessor>(); EventHub = A.Fake <ILifeCycleEventPublisher>(); CancellationProcessor = A.Fake <ICancellationProcessor>(); DateTimeProvider = A.Fake <IDateTimeProvider>(); MiddlewareRunner = A.Fake <IWorkflowMiddlewareRunner>(); StepExecutor = A.Fake <IStepExecutor>(); Options = new WorkflowOptions(A.Fake <IServiceCollection>()); var stepExecutionScope = A.Fake <IServiceScope>(); A.CallTo(() => ScopeProvider.CreateScope(A <IStepExecutionContext> ._)).Returns(stepExecutionScope); A.CallTo(() => stepExecutionScope.ServiceProvider).Returns(ServiceProvider); var scope = A.Fake <IServiceScope>(); var scopeFactory = A.Fake <IServiceScopeFactory>(); A.CallTo(() => ServiceProvider.GetService(typeof(IServiceScopeFactory))).Returns(scopeFactory); A.CallTo(() => scopeFactory.CreateScope()).Returns(scope); A.CallTo(() => scope.ServiceProvider).Returns(ServiceProvider); A.CallTo(() => DateTimeProvider.Now).Returns(DateTime.Now); A.CallTo(() => DateTimeProvider.UtcNow).Returns(DateTime.UtcNow); A .CallTo(() => ServiceProvider.GetService(typeof(IWorkflowMiddlewareRunner))) .Returns(MiddlewareRunner); A .CallTo(() => ServiceProvider.GetService(typeof(IStepExecutor))) .Returns(StepExecutor); A.CallTo(() => MiddlewareRunner .RunPostMiddleware(A <WorkflowInstance> ._, A <WorkflowDefinition> ._)) .Returns(Task.CompletedTask); A.CallTo(() => MiddlewareRunner .RunExecuteMiddleware(A <WorkflowInstance> ._, A <WorkflowDefinition> ._)) .Returns(Task.CompletedTask); A.CallTo(() => StepExecutor.ExecuteStep(A <IStepExecutionContext> ._, A <IStepBody> ._)) .ReturnsLazily(call => call.Arguments[1].As <IStepBody>().RunAsync( call.Arguments[0].As <IStepExecutionContext>())); //config logging var loggerFactory = new LoggerFactory(); //loggerFactory.AddConsole(LogLevel.Debug); Subject = new WorkflowExecutor(Registry, ServiceProvider, ScopeProvider, DateTimeProvider, ResultProcesser, EventHub, CancellationProcessor, Options, loggerFactory); }
public PhoneEnvReferenceSlice(FdoCache cache, ICmObject obj, int flid, XmlNode configurationNode, IPersistenceProvider persistenceProvider, Mediator mediator, StringTable stringTbl) : base(cache, obj, flid,configurationNode, persistenceProvider, mediator, stringTbl) { Debug.Assert(obj is MoAffixAllomorph || obj is MoStemAllomorph); m_persistenceProvider = persistenceProvider; }
/// <summary> /// Initialize the launcher. /// </summary> /// <param name="cache"></param> /// <param name="obj"></param> /// <param name="flid"></param> /// <param name="fieldName"></param> public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider, Mediator mediator, string displayNameProperty, string displayWs) { CheckDisposed(); base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs); m_msaDlglauncherView.Init(mediator, obj as MoMorphSynAnalysis); }
public WorkflowController(IPersistenceProvider persistenceStore, IDistributedLockProvider lockProvider, IWorkflowRegistry registry, IQueueProvider queueProvider, ILoggerFactory loggerFactory) { _persistenceStore = persistenceStore; _lockProvider = lockProvider; _registry = registry; _queueProvider = queueProvider; _logger = loggerFactory.CreateLogger <WorkflowController>(); }
/// <summary> /// /// </summary> /// <param name="persistenceProvider"></param> /// <param name="stringTbl"></param> protected override void SetupControls(IPersistenceProvider persistenceProvider, Mediator mediator, StringTable stringTbl) { base.SetupControls(persistenceProvider, mediator, stringTbl); AtomicReferenceLauncher arl = Control as AtomicReferenceLauncher; arl.ReferenceChanged += new FwSelectionChangedEventHandler(OnReferenceChanged); }
/// <summary> /// Constructor invoked via the editor="customWithParams" slice XML configuration /// </summary> /// <param name="cache"></param> /// <param name="editor"></param> /// <param name="flid"></param> /// <param name="node"></param> /// <param name="obj"></param> /// <param name="stringTbl"></param> /// <param name="persistenceProvider"></param> /// <param name="ws"></param> public BasicIPASymbolSlice(FdoCache cache, string editor, int flid, System.Xml.XmlNode node, ICmObject obj, StringTable stringTbl, IPersistenceProvider persistenceProvider, int ws) : base(obj, flid, ws) { var phoneme = (IPhPhoneme)m_obj; phoneme.BasicIPASymbolChanged += UpdatePhoneme; }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="AtomicReferenceSlice"/> class. /// </summary> /// ----------------------------------------------------------------------------------- public AtomicReferenceSlice(FdoCache cache, ICmObject obj, int flid, XmlNode configurationNode, IPersistenceProvider persistenceProvider, Mediator mediator, StringTable stringTbl) : base(cache, obj, flid, configurationNode, persistenceProvider, mediator, stringTbl) { m_sda = m_cache.MainCacheAccessor; m_sda.AddNotification(this); }
public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider, Mediator mediator, string displayNameProperty, string displayWs) { CheckDisposed(); base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs); m_atomicRefView.Initialize(obj, flid, fieldName, cache, displayNameProperty, mediator, displayWs); }
public RunnablePoller(IPersistenceProvider persistenceStore, IQueueProvider queueProvider, ILoggerFactory loggerFactory, IServiceProvider serviceProvider, IWorkflowRegistry registry, IDistributedLockProvider lockProvider, WorkflowOptions options) { _persistenceStore = persistenceStore; _queueProvider = queueProvider; _logger = loggerFactory.CreateLogger <RunnablePoller>(); _lockProvider = lockProvider; _options = options; }
#pragma warning restore 0414 public ReversalIndexEntryFormSlice(FdoCache cache, string editor, int flid, XmlNode node, ICmObject obj, StringTable stringTbl, IPersistenceProvider persistenceProvider, int ws) : base(obj, flid, WritingSystemServices.kwsAllReversalIndex, 0, false, true, true) { m_configNode = node; m_stringTbl = stringTbl; m_persistProvider = persistenceProvider; }
public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider, Mediator mediator, string displayNameProperty, string displayWs) { CheckDisposed(); base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs); m_atomicRefView.Initialize(obj, flid, cache, displayNameProperty, mediator); }
/// <summary> /// Initialize the launcher. /// </summary> /// <param name="cache"></param> /// <param name="obj"></param> /// <param name="flid"></param> /// <param name="fieldName"></param> public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider, Mediator mediator, string displayNameProperty, string displayWs) { CheckDisposed(); base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs); m_msaInflectionFeatureListDlgLauncherView.Init(mediator, obj as IFsFeatStruc); }
protected given_initated_payment(IPersistenceProvider sutProvider) { this.sutProvider = sutProvider; this.sut = new ThirdPartyProcessorPayment(PaymentId, SourceId, "payment", 300, new[] { new ThidPartyProcessorPaymentItem("item1", 100), new ThidPartyProcessorPaymentItem("item2", 200) }); this.sut = this.sutProvider.PersistReload(this.sut); }
/// <summary> /// Constructor. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="obj">CmObject that is being displayed.</param> /// <param name="flid">The field identifier for the attribute we are displaying.</param> public MSAReferenceComboBoxSlice(FdoCache cache, ICmObject obj, int flid, IPersistenceProvider persistenceProvider, Mediator mediator) : base(new UserControl(), cache, obj, flid) { m_mediator = mediator; m_persistProvider = persistenceProvider; m_tree = new TreeCombo(); m_tree.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor; m_tree.Font = new System.Drawing.Font(cache.LangProject.DefaultAnalysisWritingSystemFont, 10); if (!Application.RenderWithVisualStyles) m_tree.HasBorder = false; //Set the stylesheet and writing system information so that the font size for the IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); m_tree.WritingSystemCode = cache.LangProject.DefaultAnalysisWritingSystem; m_tree.StyleSheet = stylesheet; // We embed the tree combo in a layer of UserControl, so it can have a fixed width // while the parent window control is, as usual, docked 'fill' to work with the splitter. m_tree.Dock = DockStyle.Left; m_tree.Width = 240; m_tree.DropDown += new EventHandler(m_tree_DropDown); Control.Controls.Add(m_tree); m_tree.SizeChanged += new EventHandler(m_tree_SizeChanged); if (m_MSAPopupTreeManager == null) { ICmPossibilityList list = m_cache.LangProject.PartsOfSpeechOA; int ws = m_cache.LangProject.DefaultAnalysisWritingSystem; m_tree.WritingSystemCode = ws; m_MSAPopupTreeManager = new MSAPopupTreeManager(m_tree, m_cache, list, ws, true, mediator, (Form)mediator.PropertyTable.GetValue("window")); m_MSAPopupTreeManager.AfterSelect += new TreeViewEventHandler(m_MSAPopupTreeManager_AfterSelect); m_MSAPopupTreeManager.Sense = m_obj as ILexSense; m_MSAPopupTreeManager.PersistenceProvider = m_persistProvider; } try { m_handlingMessage = true; m_MSAPopupTreeManager.MakeTargetMenuItem(); //m_MSAPopupTreeManager.LoadPopupTree(0); } finally { m_handlingMessage = false; } if (m_cache != null) { m_sda = m_cache.MainCacheAccessor; m_sda.AddNotification(this); } m_treeBaseWidth = m_tree.Width; Control.Height = m_tree.PreferredHeight; // m_tree has sensible PreferredHeight once the text is set, UserControl does not. //we need to set the Height after m_tree.Text has a value set to it. }
/// <summary> /// When accessing a db4o embedded database we should use the same instance. /// </summary> /// <returns></returns> public IPersistenceProvider GetProvider() { if (this.provider == null) { var db = Db4oFactory.OpenFile(this.ConnectionString); this.provider = new Db4OPersistenceProvider(db, this); } return this.provider; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if(disposing) { if(_persistenceProvider != null) { _persistenceProvider.Dispose(); _persistenceProvider = null; } } }
/// <summary> /// constructor for use with adding a new value /// </summary> /// <param name="persistProvider">The persist provider.</param> /// <param name="labels">The labels.</param> /// <param name="fieldName">the user-readable name of the field that is being edited</param> /// <param name="obj">The obj.</param> /// <param name="displayNameProperty">The display name property.</param> /// <param name="flid">The flid.</param> /// <param name="sShowAllTypes">The show all types string.</param> public MorphTypeChooser(IPersistenceProvider persistProvider, IEnumerable<ObjectLabel> labels, string fieldName, ICmObject obj, string displayNameProperty, int flid, string sShowAllTypes, IHelpTopicProvider helpTopicProvider) : base(persistProvider, labels, fieldName, helpTopicProvider) { m_obj = obj; m_displayNameProperty = displayNameProperty; m_flid = flid; InitMorphTypeForm(sShowAllTypes); }
/// <summary> /// Initialize the launcher. /// </summary> /// <param name="cache"></param> /// <param name="obj"></param> /// <param name="flid"></param> /// <param name="fieldName"></param> public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider, Mediator mediator, string displayNameProperty, string displayWs) { CheckDisposed(); base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs); m_PhonologicalFeatureListDlgLauncherView.Init(mediator, obj as IFsFeatStruc); if (Slice.Object.ClassID == PhPhonemeTags.kClassId) m_PhonologicalFeatureListDlgLauncherView.Phoneme = Slice.Object as IPhPhoneme; }
public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider, Mediator mediator, string displayNameProperty, string displayWs) { CheckDisposed(); Debug.Assert(obj is MoAffixAllomorph || obj is MoStemAllomorph); base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs); m_phoneEnvRefView.Initialize((MoForm)obj, flid, cache); }
/// <summary> /// constructor for use with adding a new value /// </summary> /// <param name="labels"></param> /// <param name="fieldName">the user-readable name of the field that is being edited /// </param> public MorphTypeChooser(IPersistenceProvider persistProvider, ObjectLabelCollection labels, string fieldName, ICmObject obj, string displayNameProperty, int flid, string sShowAllTypes) : base(persistProvider, labels, fieldName) { m_obj = obj; m_displayNameProperty = displayNameProperty; m_flid = flid; InitMorphTypeForm(sShowAllTypes); }
/// <summary> /// We want the persistence provider, and the easiest way to get it is to get all /// this other stuff we don't need or use. /// </summary> /// <param name="cache"></param> /// <param name="editor"></param> /// <param name="flid"></param> /// <param name="node"></param> /// <param name="obj"></param> /// <param name="stringTbl"></param> /// <param name="persistenceProvider"></param> /// <param name="ws"></param> public PhonologicalFeatureListDlgLauncherSlice(FdoCache cache, string editor, int flid, System.Xml.XmlNode node, ICmObject obj, StringTable stringTbl, IPersistenceProvider persistenceProvider, int ws) { m_obj = obj; // is PhPhoneme m_persistenceProvider = persistenceProvider; m_ws = ws; m_node = node; m_configurationNode = node; }
public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider, Mediator mediator, string displayNameProperty, string displayWs) { CheckDisposed(); base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs); m_autoComplete = new PossibilityAutoComplete(cache, mediator, (ICmPossibilityList) obj.ReferenceTargetOwner(flid), m_vectorRefView, displayNameProperty, displayWs); m_autoComplete.PossibilitySelected += HandlePossibilitySelected; m_vectorRefView.RootBox.DataAccess.AddNotification(this); }
/// <summary> /// Constructor. /// </summary> /// <param name="obj">CmObject that is being displayed.</param> /// <param name="flid">The field identifier for the attribute we are displaying.</param> /// // cache, obj, flid, node, persistenceProvider, stringTbl public AtomicReferencePOSSlice(FdoCache cache, ICmObject obj, int flid, IPersistenceProvider persistenceProvider, Mediator mediator) : base(new UserControl(), cache, obj, flid) { IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); m_persistProvider = persistenceProvider; m_tree = new TreeCombo(); m_tree.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor; m_tree.WritingSystemCode = m_cache.LangProject.DefaultAnalysisWritingSystem; m_tree.Font = new System.Drawing.Font(cache.LangProject.DefaultAnalysisWritingSystemFont, 10); m_tree.StyleSheet = stylesheet; if (!Application.RenderWithVisualStyles) m_tree.HasBorder = false; // We embed the tree combo in a layer of UserControl, so it can have a fixed width // while the parent window control is, as usual, docked 'fill' to work with the splitter. m_tree.Dock = DockStyle.Left; m_tree.Width = 200; Control.Controls.Add(m_tree); if (m_pOSPopupTreeManager == null) { ICmPossibilityList list; int ws; if (obj is ReversalIndexEntry) { IReversalIndexEntry rie = obj as IReversalIndexEntry; list = rie.ReversalIndex.PartsOfSpeechOA; ws = rie.ReversalIndex.WritingSystemRAHvo; } else { list = m_cache.LangProject.PartsOfSpeechOA; ws = m_cache.LangProject.DefaultAnalysisWritingSystem; } m_tree.WritingSystemCode = ws; m_pOSPopupTreeManager = new POSPopupTreeManager(m_tree, m_cache, list, ws, false, mediator, (Form)mediator.PropertyTable.GetValue("window")); m_pOSPopupTreeManager.AfterSelect += new TreeViewEventHandler(m_pOSPopupTreeManager_AfterSelect); } try { m_handlingMessage = true; m_pOSPopupTreeManager.LoadPopupTree(POS == null ? 0 : POS.Hvo); } finally { m_handlingMessage = false; } Control.Height = m_tree.PreferredHeight; // m_tree has sensible PreferredHeight once the text is set, UserControl does not. // we need to set the Height after m_tree.Text has a value set to it. }
public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider, XCore.Mediator mediator, string displayNameProperty, string displayWs) { CheckDisposed(); base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs); m_view.Init(mediator, obj, this, new MetaRuleFormulaVc(cache, mediator), MetaRuleFormulaVc.kfragRule); m_insertionControl.AddOption(new InsertOption(RuleInsertType.Phoneme), DisplayOption); m_insertionControl.AddOption(new InsertOption(RuleInsertType.NaturalClass), DisplayOption); m_insertionControl.AddOption(new InsertOption(RuleInsertType.Features), DisplayOption); m_insertionControl.AddOption(new InsertOption(RuleInsertType.WordBoundary), DisplayOption); m_insertionControl.AddOption(new InsertOption(RuleInsertType.MorphemeBoundary), DisplayOption); m_insertionControl.NoOptionsMessage = DisplayNoOptsMsg; }
public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider, XCore.Mediator mediator, string displayNameProperty, string displayWs) { CheckDisposed(); base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs); m_view.Init(mediator, obj, this, new MetaRuleFormulaVc(cache, mediator), MetaRuleFormulaVc.kfragRule); m_insertionControl.Initialize(cache, mediator, persistProvider, Rule.Name.BestAnalysisAlternative.Text); m_insertionControl.AddOption(RuleInsertType.PHONEME, DisplayOption); m_insertionControl.AddOption(RuleInsertType.NATURAL_CLASS, DisplayOption); m_insertionControl.AddOption(RuleInsertType.FEATURES, DisplayOption); m_insertionControl.AddOption(RuleInsertType.WORD_BOUNDARY, DisplayOption); m_insertionControl.AddOption(RuleInsertType.MORPHEME_BOUNDARY, DisplayOption); m_insertionControl.NoOptionsMessage = DisplayNoOptsMsg; }
/// <summary> /// Constructor invoked via the editor="customWithParams" slice XML configuration /// </summary> /// <param name="cache"></param> /// <param name="editor"></param> /// <param name="flid"></param> /// <param name="node"></param> /// <param name="obj"></param> /// <param name="stringTbl"></param> /// <param name="persistenceProvider"></param> /// <param name="ws"></param> public BasicIPASymbolSlice(FdoCache cache, string editor, int flid, System.Xml.XmlNode node, ICmObject obj, StringTable stringTbl, IPersistenceProvider persistenceProvider, int ws) : base(obj.Hvo, flid, ws) { m_obj = obj; // is PhPhoneme //m_persistenceProvider = persistenceProvider; m_ws = ws; //m_node = node; m_configurationNode = node; m_sda = cache.MainCacheAccessor; m_sda.AddNotification(this); this.Disposed += new EventHandler(BasicIPASymbolSlice_Disposed); m_IPAMapperDocument = new XmlDocument(); string sIPAMapper = Path.Combine(DirectoryFinder.TemplateDirectory, PhPhoneme.ksBasicIPAInfoFile); m_IPAMapperDocument.Load(sIPAMapper); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="ReferenceSlice"/> class. /// </summary> /// ----------------------------------------------------------------------------------- public ReferenceSlice(FdoCache cache, ICmObject obj, int flid, XmlNode configurationNode, IPersistenceProvider persistenceProvider, Mediator mediator, StringTable stringTbl) : base(null, cache, obj, flid) { ConfigurationNode = configurationNode;//todo: remove this when FieldSlice gets the node as part of its constructor // have chooser title use the same text as the label if (mediator != null && mediator.HasStringTable) m_fieldName = XmlUtils.GetLocalizedAttributeValue(mediator.StringTbl, configurationNode, "label", m_fieldName); else if (stringTbl != null) m_fieldName = XmlUtils.GetLocalizedAttributeValue(stringTbl, configurationNode, "label", m_fieldName); else m_fieldName = XmlUtils.GetOptionalAttributeValue( configurationNode, "label", m_fieldName); SetupControls(persistenceProvider, mediator, stringTbl); }
public void Dispose(bool disposing) { if (disposing) GC.SuppressFinalize(this); if (this.provider == null) return; log.DebugFormat("Disposing Db4oPersistenceProvider..."); try { //((Db4OPersistenceProvider)this.provider).ObjectContainer.Close(); ((Db4OPersistenceProvider)this.provider).ObjectContainer.Dispose(); } catch (Exception ex) { log.ErrorFormat("Error disposing: Db4OFileProviderManager.Dispose(): ", ex); } provider = null; }
/// <summary> /// Constructor. /// </summary> /// <param name="obj">CmObject that is being displayed.</param> /// <param name="flid">The field identifier for the attribute we are displaying.</param> public ReferenceComboBoxSlice(FdoCache cache, ICmObject obj, int flid, IPersistenceProvider persistenceProvider) : base(new UserControl(), cache, obj, flid) { m_persistProvider = persistenceProvider; m_combo = new FwComboBox(); m_combo.WritingSystemFactory = cache.WritingSystemFactory; m_combo.DropDownStyle = ComboBoxStyle.DropDownList; m_combo.Font = new System.Drawing.Font( cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.DefaultFontName, 10); if (!Application.RenderWithVisualStyles) m_combo.HasBorder = false; m_combo.Dock = DockStyle.Left; m_combo.Width = 200; Control.Height = m_combo.Height; // Combo has sensible default height, UserControl does not. Control.Controls.Add(m_combo); m_combo.SelectedIndexChanged += SelectionChanged; }
/// <summary> /// Constructor. /// </summary> /// <param name="obj">CmObject that is being displayed.</param> /// <param name="flid">The field identifier for the attribute we are displaying.</param> public ReferenceComboBoxSlice(FdoCache cache, ICmObject obj, int flid, IPersistenceProvider persistenceProvider, Mediator mediator) : base(new UserControl(), cache, obj, flid) { m_mediator = mediator; m_persistProvider = persistenceProvider; m_combo = new FwComboBox(); m_combo.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor; m_combo.DropDownStyle = ComboBoxStyle.DropDownList; m_combo.Font = new System.Drawing.Font( cache.LangProject.DefaultVernacularWritingSystemFont, 10); if (!Application.RenderWithVisualStyles) m_combo.HasBorder = false; m_combo.Dock = DockStyle.Left; m_combo.Width = 200; Control.Height = m_combo.Height; // Combo has sensible default height, UserControl does not. Control.Controls.Add(m_combo); m_combo.SelectedIndexChanged += new EventHandler(SelectionChanged); // Load the special strings from the string table if possible. If not, use the // default (English) values. if (mediator != null && mediator.HasStringTable) { StringTbl = mediator.StringTbl; if (StringTbl != null) { m_sNullItemLabel = StringTbl.GetString("NullItemLabel", "DetailControls/ReferenceComboBox"); } } if (m_sNullItemLabel == null || m_sNullItemLabel == "" || m_sNullItemLabel == "*NullItemLabel*") { m_sNullItemLabel = DetailControlsStrings.ksNullLabel; } }
/// <summary> /// Initialize the dialog before showing it. /// </summary> /// <param name="cache"></param> /// <param name="entry"></param> /// <param name="titleForEdit">Edit title appropriate to the button's context.</param> public void SetDlgInfo(FdoCache cache, IPersistenceProvider persistProvider, Mediator mediator, ILexEntry entry, DummyGenericMSA dummyMsa, int hvoOriginalMsa, bool useForEdit, string titleForEdit) { CheckDisposed(); Debug.Assert(m_cache == null); MsaType msaType = dummyMsa.MsaType; m_cache = cache; m_mediator = mediator; if (useForEdit) { // Change the window title and the OK button text. Text = titleForEdit; s_helpTopic = "khtpEditGrammaticalFunction"; this.helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(s_helpTopic, 0)); btnOk.Text = LexText.Controls.LexTextControls.ks_OK; } // Set font, writing system factory, and code for the edit box. float fntSize = label1.Font.Size * 2.0F; m_fwtbCitationForm.Font = new Font(m_cache.LangProject.DefaultVernacularWritingSystemFont, fntSize); m_fwtbCitationForm.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_fwtbCitationForm.WritingSystemCode = m_cache.LangProject.DefaultVernacularWritingSystem; m_fwtbCitationForm.AdjustForStyleSheet(this, null, mediator); m_fwtbCitationForm.AdjustStringHeight = false; m_fwtbCitationForm.Tss = entry.HeadWord; m_fwtbCitationForm.HasBorder = false; m_fwtbSenses.Font = new Font(m_cache.LangProject.DefaultVernacularWritingSystemFont, fntSize); m_fwtbSenses.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_fwtbSenses.WritingSystemCode = m_cache.LangProject.DefaultVernacularWritingSystem; m_fwtbSenses.AdjustForStyleSheet(this, null, mediator); m_fwtbSenses.AdjustStringHeight = false; string sSenses = string.Empty; ITsIncStrBldr tisb = TsIncStrBldrClass.Create(); foreach (ILexSense sense in entry.AllSenses) { if (sense.MorphoSyntaxAnalysisRA != null) { if (sense.MorphoSyntaxAnalysisRAHvo == hvoOriginalMsa) { if (tisb.Text != null) tisb.Append(", "); // REVIEW: IS LOCALIZATION NEEDED FOR BUILDING THIS LIST? tisb.AppendTsString(sense.ShortNameTSS); } } } m_fwtbSenses.Tss = tisb.GetString(); m_fwtbSenses.HasBorder = false; m_msaGroupBox.Initialize(m_cache, m_mediator, this, dummyMsa); int oldHeight = m_msaGroupBox.Height; int newHeight = Math.Max(oldHeight, m_msaGroupBox.PreferredHeight); int delta = newHeight - oldHeight; if (delta > 0) { m_msaGroupBox.AdjustInternalControlsAndGrow(); Debug.Assert(m_msaGroupBox.Height == m_msaGroupBox.PreferredHeight); FontHeightAdjuster.GrowDialogAndAdjustControls(this, delta, m_msaGroupBox); } if (mediator != null) { // Reset window location. // Get location to the stored values, if any. object locWnd = m_mediator.PropertyTable.GetValue("msaCreatorDlgLocation"); // JohnT: this dialog can't be resized. So it doesn't make sense to // remember a size. If we do, we need to override OnLoad (as in SimpleListChooser) // to prevent the dialog growing every time at 120 dpi. But such an override // makes it too small to show all the controls at the default size. // It's better just to use the default size until it's resizeable for some reason. //m_mediator.PropertyTable.GetValue("msaCreatorDlgSize"); object szWnd = this.Size; if (locWnd != null && szWnd != null) { Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd); ScreenUtils.EnsureVisibleRect(ref rect); DesktopBounds = rect; StartPosition = FormStartPosition.Manual; } } }