示例#1
0
 void IEventsVisitor.Visit(ObjectCreation objectCreation)
 {
     CreateElement(SC.Elt_ObjectCreation, objectCreation.Trigger,
                   new XAttribute(SC.Attr_ObjectId, objectCreation.ObjectId),
                   MakeNullableAttr(SC.Attr_ObjectType, objectCreation.ObjectType.TypeName),
                   MakeNullableAttr(SC.Attr_DisplayIdPropertyName, objectCreation.ObjectType.DisplayIdPropertyName),
                   MakeNullableAttr(SC.Attr_PrimaryPropertyName, objectCreation.ObjectType.PrimaryPropertyName),
                   objectCreation.ObjectType.IsTimeless ? new XAttribute(SC.Attr_IsTimeless, "1") : null,
                   objectCreation.IsWeak ? new XAttribute(SC.Attr_IsWeak, "1") : null,
                   MakeTagsAttr(objectCreation)
                   );
 }
示例#2
0
        public IEnumerable <Event> Deserialize(XElement root)
        {
            foreach (var elt in root.Elements())
            {
                Event ret = null;
                switch (elt.Name.LocalName)
                {
                case SC.Elt_ObjectCreation:
                    ret = new ObjectCreation(
                        MakeTrigger(elt),
                        objectIdsPool.Intern(Attr(elt, SC.Attr_ObjectId)),
                        objectInfoPool.Intern(new ObjectTypeInfo(
                                                  Attr(elt, SC.Attr_ObjectType),
                                                  Attr(elt, SC.Attr_CommentPropertyName),
                                                  Attr(elt, SC.Attr_PrimaryPropertyName),
                                                  (Attr(elt, SC.Attr_IsTimeless) ?? "0") == "1"
                                                  )),
                        isWeak: (Attr(elt, SC.Attr_IsWeak) ?? "0") == "1",
                        displayName: Attr(elt, SC.Attr_DisplayNamePropertyName)
                        );
                    break;

                case SC.Elt_ObjectDeletion:
                    ret = new ObjectDeletion(MakeTrigger(elt), objectIdsPool.Intern(Attr(elt, SC.Attr_ObjectId)), null);
                    break;

                case SC.Elt_PropertyChange:
                    ret = new PropertyChange(MakeTrigger(elt),
                                             objectIdsPool.Intern(Attr(elt, SC.Attr_ObjectId)),
                                             null,
                                             propertyName: propNamesPool.Intern(Attr(elt, SC.Attr_PropertyName)),
                                             value: Attr(elt, SC.Attr_Value),
                                             oldValue: Attr(elt, SC.Attr_OldValue),
                                             valueType: ToValueType(Attr(elt, SC.Attr_ValueType)));
                    break;

                case SC.Elt_ParentChildRelationChange:
                    ret = new ParentChildRelationChange(
                        MakeTrigger(elt),
                        objectIdsPool.Intern(Attr(elt, SC.Attr_ObjectId)),
                        null,
                        newParentObjectId: objectIdsPool.Intern(Attr(elt, SC.Attr_NewParentObjectId)),
                        isWeak: (Attr(elt, SC.Attr_IsWeak) ?? "0") == "1");
                    break;
                }
                if (ret != null)
                {
                    ret.Tags = tagsPool.Intern(
                        new HashSet <string>((Attr(elt, SC.Attr_Tags) ?? "").Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)));
                    yield return(ret);
                }
            }
        }
示例#3
0
 void IEventsVisitor.Visit(ObjectCreation objectCreation)
 {
     Output.AppendFormat("ObjectCreation: {0}", objectCreation.ObjectId);
 }