示例#1
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlPropertyNode)source;

            AbstractPropertyId = castedSource.AbstractPropertyId;
        }
示例#2
0
 internal static void RegisterXmlElements()
 {
     foreach (YqlOperation value in Enum.GetValues(typeof(YqlOperation)))
     {
         YqlNode.RegisterXmlElement(typeof(YqlOperationNode), value.ToString());
     }
 }
示例#3
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlValueNode)source;

            Value = castedSource.Value;
        }
示例#4
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlListContainsNode)source;

            this.List       = CloneIfNotNull(castedSource.List);
            this.ItemToFind = CloneIfNotNull(castedSource.ItemToFind);
        }
示例#5
0
 public static YqlNode CloneIfNotNull(YqlNode source)
 {
     if (source == null)
     {
         return(null);
     }
     return(source.Clone());
 }
示例#6
0
 internal static XElement SaveToXmlOrNull(YqlNode node)
 {
     if (node == null)
     {
         return(null);
     }
     return(node.SaveToXml());
 }
示例#7
0
 public YqlTextMatchNode(YqlNode sourceString,
                         string searchText, bool wholeWords, bool matchAllWords)
 {
     this.SourceString  = sourceString;
     this.SearchText    = searchText;
     this.WholeWords    = wholeWords;
     this.MatchAllWords = matchAllWords;
 }
示例#8
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlListNode)source;

            this.Items.Clear();
            this.Items.AddRange(castedSource.Items.Select(x => x.Clone()));
        }
示例#9
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlObjectActionNode)source;

            this.TargetObject     = YqlNode.CloneIfNotNull(castedSource.TargetObject);
            this.TargetObjectType = castedSource.TargetObjectType;
        }
示例#10
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlOperationNode)source;

            Operation = castedSource.Operation;
            Args.Clear();
            Args.AddRange(castedSource.Args.Select(x => x.Clone()));
        }
示例#11
0
 public YqlCompiledNode(YqlNode node, Expression expression, IEnumerable <YqlCompiledNode> compiledArgs)
 {
     if (node == null)
     {
         throw new ArgumentNullException("node");
     }
     this.Node         = node;
     this.Expression   = expression;
     this.CompiledArgs = new ReadOnlyCollection <YqlCompiledNode>(compiledArgs.ToArray());
 }
示例#12
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlTextMatchNode)source;

            this.SourceString  = castedSource.SourceString;
            this.SearchText    = castedSource.SearchText;
            this.WholeWords    = castedSource.WholeWords;
            this.MatchAllWords = castedSource.MatchAllWords;
        }
示例#13
0
        public YqlNode Clone()
        {
#if true
            YqlNode clonedNode = (YqlNode)Activator.CreateInstance(GetType());
            clonedNode.CopyFrom(this);
#else
            XElement xxx = this.SaveToXml();
            Debug.WriteLine(xxx.ToString());
            YqlNode clonedNode = YqlNode.LoadFromXml(xxx);
#endif
            return(clonedNode);
        }
示例#14
0
        internal static YqlNode LoadFromXml(XElement element)
        {
            if (element == null)
            {
                return(null);
            }
            Type    type = xmlNameToType[element.Name.ToString()];
            YqlNode node = (YqlNode)Activator.CreateInstance(type);

            node.LoadXmlElement(element);
            return(node);
        }
示例#15
0
        internal Func <YqlExecutionContext, bool> CompileMessage(YqlNode rootNode)
        {
            var compiledNode = CompileNode(rootNode.Clone());
            //Debug.WriteLine(compiledNode.Expression.ToString());
            //Debug.WriteLine("-------");
            var lambda = Expression.Lambda <Func <YqlExecutionContext, bool> >(compiledNode.Expression, ExecutionContextParameter);
            //Debug.WriteLine(lambda.ToString());
            //Debug.WriteLine("-------");
            Func <YqlExecutionContext, bool> func = lambda.Compile();

            return(func);
        }
示例#16
0
        internal static void RegisterXmlElements(YamsterModelType modelType,
                                                 Type classType, Type enumType)
        {
            if (!typeof(YqlPropertyNode).IsAssignableFrom(classType))
            {
                throw new ArgumentException("The classType must inherit from YqlPropertyNode");
            }
            if (!enumType.IsEnum)
            {
                throw new ArgumentException("The enumType must be an enum");
            }

            foreach (Enum enumValue in Enum.GetValues(enumType))
            {
                // E.g. "Message_UserIdRepliedTo"
                string xmlName = modelType.ToString() + "_" + enumValue.ToString();
                YqlNode.RegisterXmlElement(classType, xmlName);
            }
        }
示例#17
0
        internal static void RegisterXmlElements()
        {
            var typeCodes = new TypeCode[]
            {
                TypeCode.Boolean,
                TypeCode.DateTime,
                TypeCode.Int16,
                TypeCode.Int32,
                TypeCode.Int64,
                TypeCode.UInt16,
                TypeCode.UInt32,
                TypeCode.UInt64,
                TypeCode.String
            };

            foreach (TypeCode typeCode in typeCodes)
            {
                YqlNode.RegisterXmlElement(typeof(YqlValueNode), typeCode.ToString());
            }
        }
示例#18
0
 public YamsterThreadQuery(string title, YqlNode filterNode)
     : base(title, filterNode)
 {
 }
示例#19
0
 public virtual void CopyFrom(YqlNode source)
 {
     this.SourceLocation = source.SourceLocation;
 }
示例#20
0
 public virtual void CopyFrom(YamsterModelQuery source)
 {
     this.Title      = source.Title;
     this.FilterNode = YqlNode.CloneIfNotNull(source.FilterNode);
 }
示例#21
0
 public YqlCompiledNode(YqlNode node, Expression expression)
     : this(node, expression, new YqlCompiledNode[0])
 {
 }
示例#22
0
 protected YqlPropertyNode(PropertyMapping mapping, YamsterModelType targetObjectType, YqlNode targetObject)
     : base(targetObjectType, targetObject)
 {
     this.Mapping = mapping;
 }
示例#23
0
 public YqlUserPropertyNode(YqlUserProperty propertyId, YqlNode targetObject = null)
     : base(UserMapping, YamsterModelType.User, targetObject)
 {
     this.PropertyId = propertyId;
 }
示例#24
0
 public YqlMessagePropertyNode(YqlMessageProperty propertyId, YqlNode targetObject = null)
     : base(MessageMapping, YamsterModelType.Message, targetObject)
 {
     this.PropertyId = propertyId;
 }
示例#25
0
 public YqlThreadPropertyNode(YqlThreadProperty propertyId, YqlNode targetObject = null)
     : base(ThreadMapping, YamsterModelType.Thread, targetObject)
 {
     this.PropertyId = propertyId;
 }
示例#26
0
 public YamsterMessageQuery(string title, YqlNode filterNode)
     : base(title, filterNode)
 {
 }
示例#27
0
 protected void LoadFromXml(XElement element)
 {
     this.Title      = XmlUtilities.GetStringAttribute(element, "Title");
     this.FilterNode = YqlNode.LoadFromXml(XmlUtilities.GetChildElement(element, "FilterNode"));
 }
示例#28
0
 protected override void LoadXmlElement(XElement element)
 {
     this.List       = LoadFromXmlOrNull(element, "List");
     this.ItemToFind = LoadFromXmlOrNull(element, "ItemToFind");
 }
示例#29
0
 public YqlCompiledNode CompileNode(YqlNode node)
 {
     return(node.CompileNode(this));
 }
示例#30
0
 public YamsterModelQuery(string title, YqlNode filterNode)
 {
     this.Title      = title;
     this.FilterNode = filterNode;
 }