/// <summary>
        /// Initialize configuration services and add it to service container
        /// </summary>
        private void CreateServices()
        {
            Debug.Assert(m_serviceContainers.Count == 2);
            ChangeGroupManager changeGroupManager = null;

            foreach (KeyValuePair <Guid, ServiceContainer> container in m_serviceContainers)
            {
                ConfigurationService configurationService = new ConfigurationService(m_globalConfiguration, Configuration, container.Key);
                container.Value.AddService(typeof(ConfigurationService), configurationService);

                var sqlChangeGroupManager             = new SqlChangeGroupManager(m_session, container.Key);
                ChangeGroupService changeGroupService = new ChangeGroupService(sqlChangeGroupManager);
                sqlChangeGroupManager.ChangeGroupService = changeGroupService;
                container.Value.AddService(typeof(ChangeGroupService), changeGroupService);

                if (null == changeGroupManager)
                {
                    changeGroupManager = sqlChangeGroupManager;
                }
                else
                {
                    changeGroupManager.OtherSideChangeGroupManager    = sqlChangeGroupManager;
                    sqlChangeGroupManager.OtherSideChangeGroupManager = changeGroupManager;
                }
            }
        }
        private static ChangeGroup realizeChangeGroup(SqlDataReader reader, ChangeGroupManager manager)
        {
            SqlChangeGroup group = null;

            if (reader != null && reader.HasRows)
            {
                if (reader.Read())
                {
                    loadOrdinalCache(reader);

                    group = new SqlChangeGroup(manager);
                    group.ChangeGroupId  = reader.GetInt32(s_ordinalChangeGroupId);
                    group.ChangeTimeUtc  = reader.GetDateTime(s_ordinalChangeTime);
                    group.Comment        = reader.GetString(s_ordinalComment);
                    group.ExecutionOrder = reader.GetInt64(s_ordinalExecutionOrder);
                    group.Owner          = reader.GetString(s_ordinalOwner);
                    group.Status         = (ChangeStatus)reader.GetInt32(s_ordinalStatus);
                    group.SessionId      = new Guid(reader.GetString(s_ordinalSessionId));
                    group.SourceId       = reader.GetGuid(s_ordinalSourceId);
                    // TODO DB changed neededgroup.Direction = (MigrationDirection)reader.GetInt32(s_ordinalDirection);
                    group.Name = reader.GetString(s_ordinalName);
                }

                if (reader.Read())
                {
                    throw new MigrationException(MigrationToolkitResources.TooManyChangeGroupsReturned);
                }
            }

            return(group);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a change group service.
 /// </summary>
 /// <param name="changeGroupManager"></param>
 internal ChangeGroupService(ChangeGroupManager changeGroupManager)
 {
     if (changeGroupManager == null)
     {
         throw new ArgumentNullException("changeGroupManager");
     }
     m_changeGroupManager = changeGroupManager;
 }
        /// <summary>
        /// constructor. Saves partial change group to db.
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="groupName"></param>
        /// <param name="changeStatus"></param>
        public SqlChangeGroup(
            ChangeGroupManager manager,
            string groupName,
            ChangeStatus changeStatus)
            : base(manager)
        {
            Name   = groupName;
            Status = changeStatus;

            ListenToDefaultActionCollectionChange();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates a change group using the associated group manager.
        /// </summary>
        /// <param name="manager">The change group manager of this change group</param>
        protected ChangeGroup(ChangeGroupManager manager)
        {
            m_manager = manager;

            if (m_manager != null)
            {
                m_sourceId = m_manager.SourceId;
                if (m_manager.Session != null)
                {
                    m_sessionId = new Guid(m_manager.Session.SessionUniqueId);
                }
            }
        }
        /// <summary>
        /// constructor. Saves partial change group to db.
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="copyFromGroup"></param>
        public SqlChangeGroup(
            ChangeGroupManager manager,
            SqlChangeGroup copyFromGroup)
            : base(manager)
        {
            Name           = copyFromGroup.Name;
            ExecutionOrder = copyFromGroup.ExecutionOrder;
            Owner          = copyFromGroup.Owner;
            ChangeTimeUtc  = copyFromGroup.ChangeTimeUtc;
            Comment        = copyFromGroup.Comment;
            RevisionTime   = copyFromGroup.RevisionTime;
            ExecutionOrder = copyFromGroup.ExecutionOrder;
            Status         = copyFromGroup.Status;

            ListenToDefaultActionCollectionChange();
        }
        public IMigrationItem LoadItem(string itemBlob, ChangeGroupManager manager)
        {
            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }

            if (string.IsNullOrEmpty(itemBlob))
            {
                throw new ArgumentNullException("itemBlob");
            }

            XmlSerializer serializer = new XmlSerializer(typeof(T));

            using (StringReader strReader = new StringReader(itemBlob))
                using (XmlReader xmlReader = XmlReader.Create(strReader))
                {
                    T item = (T)serializer.Deserialize(xmlReader);

                    return(item);
                }
        }
 private static Collection <IMigrationAction> realizeActionList(SqlDataReader reader, ChangeGroupManager manager, ChangeGroup parent)
 {
     throw new NotImplementedException();
 }
 internal static ChangeGroup Next(ChangeGroupManager manager)
 {
     // ToDo
     throw new NotImplementedException();
 }
 public SqlChangeGroup(ChangeGroupManager manager)
     : base(manager)
 {
     ListenToDefaultActionCollectionChange();
 }