/// <summary> /// Performs a database update after the database schema is updated. /// </summary> public override void UpdateDatabaseAfterUpdateSchema() { base.UpdateDatabaseAfterUpdateSchema(); var holder = CurrentNodeHolder.GetInstance(ObjectSpace) ?? ObjectSpace.CreateObject<CurrentNodeHolder>(); if (holder.CurrentNode == null) { // create new replication node holder.CurrentNode = ObjectSpace.CreateObject<ReplicationNode>(); var settingsNodeId = Settings.Default.CurrentReplicationNodeId; if (!string.IsNullOrEmpty(settingsNodeId)) holder.CurrentNode.NodeId = settingsNodeId; // try to get the name for a new replication node using OnInitCurrentNodeId event var args = new InitCurrentNodeIdArgs(holder.CurrentNode.NodeId); XafDeltaModule.OnInitCurrentNodeId(args); if (!string.IsNullOrEmpty(args.NodeId)) holder.CurrentNode.NodeId = args.NodeId; holder.CurrentNode.Name = args.NodeId; } ObjectSpace.CommitChanges(); }
/// <summary> /// Performs a database update after the database schema is updated. /// </summary> public override void UpdateDatabaseAfterUpdateSchema() { base.UpdateDatabaseAfterUpdateSchema(); var holder = CurrentNodeHolder.GetInstance(ObjectSpace) ?? ObjectSpace.CreateObject <CurrentNodeHolder>(); if (holder.CurrentNode == null) { // create new replication node holder.CurrentNode = ObjectSpace.CreateObject <ReplicationNode>(); var settingsNodeId = Settings.Default.CurrentReplicationNodeId; if (!string.IsNullOrEmpty(settingsNodeId)) { holder.CurrentNode.NodeId = settingsNodeId; } // try to get the name for a new replication node using OnInitCurrentNodeId event var args = new InitCurrentNodeIdArgs(holder.CurrentNode.NodeId); XafDeltaModule.OnInitCurrentNodeId(args); if (!string.IsNullOrEmpty(args.NodeId)) { holder.CurrentNode.NodeId = args.NodeId; } holder.CurrentNode.Name = args.NodeId; } ObjectSpace.CommitChanges(); }
/// <summary> /// Called when init current node. /// </summary> /// <param name="e">The e.</param> public static void OnInitCurrentNodeId(InitCurrentNodeIdArgs e) { var handler = InitCurrentNodeId; if (handler != null) { handler(null, e); } }
/// <summary> /// Called when init current node. /// </summary> /// <param name="e">The e.</param> public static void OnInitCurrentNodeId(InitCurrentNodeIdArgs e) { var handler = InitCurrentNodeId; if (handler != null) handler(null, e); }