Beispiel #1
0
        public Literal(object[] pair)
        {
            switch ((int)pair[0])
            {
            case 0: Vid = LiteralVidEnumeration.unknown; break;

            case 1: Vid = LiteralVidEnumeration.integer;
                Value   = pair[1];
                break;

            case 2: Vid = LiteralVidEnumeration.text;
                object[] text_pair = (object[])pair[1];
                Value = new Text()
                {
                    Value = (string)text_pair[0], Lang = (string)text_pair[1]
                };
                break;

            case 3: Vid = LiteralVidEnumeration.date;
                Value   = pair[1];   // Надо как-то по-другому
                break;

            default: throw new Exception("Err: 20901");
            }
        }
Beispiel #2
0
        internal static Expression LiteraExpression(Expression literalValueExpr, LiteralVidEnumeration literalVidEnumeration)
        {
            Type type = null;

            switch (literalVidEnumeration)
            {
            case LiteralVidEnumeration.text:
                return(Expression.Property(
                           Expression.Convert(literalValueExpr, typeof(Text)),
                           "Value"));

            case LiteralVidEnumeration.typedObject:
                return(Expression.Property(
                           Expression.Convert(literalValueExpr, typeof(TypedObject)),
                           "Value"));

            case LiteralVidEnumeration.integer:
            {
                return(Expression.Call(typeof(Query).GetMethod("Convert"), literalValueExpr));
            }
            break;

            case LiteralVidEnumeration.date:
                type = typeof(long);
                break;

            case LiteralVidEnumeration.boolean:
                type = typeof(bool);
                break;

            case LiteralVidEnumeration.nil:
                throw new NotImplementedException();
            }
            return(Expression.ConvertChecked(literalValueExpr, type));
        }
Beispiel #3
0
 public Literal(LiteralVidEnumeration literalVidEnumeration)
 {
     this.vid = literalVidEnumeration;
 }
Beispiel #4
0
 public Literal(LiteralVidEnumeration vid, IGraph graph)
 {
     this.vid = vid;
     Graph    = graph;
 }
Beispiel #5
0
 public Literal(LiteralVidEnumeration vid)
 {
     this.vid = vid;
 }