Esempio n. 1
0
 public ConflictResolutionRuleViewModel(RTResolutionRule resolutionRule)
 {
     m_resolutionRule = resolutionRule;
 }
Esempio n. 2
0
        public ExistingRuleViewModel(RTResolutionRule rule, ApplicationViewModel appViewModel)
            : base(appViewModel)
        {
            m_rule = rule;

            int conflictTypeId = (int)m_rule.ConflictTypeReference.EntityKey.EntityKeyValues.First().Value;

            if (!s_conflictTypeTable.ContainsKey(conflictTypeId))
            {
                lock (s_conflictTypeTable)
                {
                    if (!s_conflictTypeTable.ContainsKey(conflictTypeId))
                    {
                        m_rule.ConflictTypeReference.Load();
                        s_conflictTypeTable.Add(conflictTypeId, m_rule.ConflictType);
                    }
                }
            }

            if (!s_migrationSourceTable.ContainsKey(m_rule.SourceInfoUniqueId))
            {
                lock (s_migrationSourceTable)
                {
                    if (!s_migrationSourceTable.ContainsKey(m_rule.SourceInfoUniqueId))
                    {
                        RuntimeEntityModel context = RuntimeEntityModel.CreateInstance();
                        var v = from s in context.RTMigrationSourceSet
                                where s.UniqueId.Equals(m_rule.SourceInfoUniqueId)
                                select s;
                        s_migrationSourceTable.Add(m_rule.SourceInfoUniqueId, v.First());
                    }
                }
            }
            m_migrationSource = s_migrationSourceTable[m_rule.SourceInfoUniqueId];

            int resolutionActionId = (int)m_rule.ResolutionActionReference.EntityKey.EntityKeyValues.First().Value;

            if (!s_resolutionActionTable.ContainsKey(resolutionActionId))
            {
                lock (s_resolutionActionTable)
                {
                    if (!s_resolutionActionTable.ContainsKey(resolutionActionId))
                    {
                        m_rule.ResolutionActionReference.Load();
                        s_resolutionActionTable.Add(resolutionActionId, m_rule.ResolutionAction);
                    }
                }
            }
            ResolutionAction = s_resolutionActionTable[resolutionActionId];

            SetConflictManager(m_rule.ScopeInfoUniqueId, m_rule.SourceInfoUniqueId, s_conflictTypeTable[conflictTypeId].ReferenceName);

            int scopeId = (int)m_rule.ScopeReference.EntityKey.EntityKeyValues.First().Value;

            if (!s_scopeTable.ContainsKey(scopeId))
            {
                lock (s_scopeTable)
                {
                    if (!s_scopeTable.ContainsKey(scopeId))
                    {
                        m_rule.ScopeReference.Load();
                        s_scopeTable.Add(scopeId, m_rule.Scope.Scope);
                    }
                }
            }
            Scope = s_scopeTable[scopeId];
        }