Exemplo n.º 1
0
        private static object ToEnum(IContext context, int classId, long enumValue)
        {
            var clazz = Container(context).ClassMetadataForID(classId);

            var enumType = NetReflector.ToNative(clazz.ClassReflector());

            return(Enum.ToObject(enumType, enumValue));
        }
Exemplo n.º 2
0
        protected override bool Accept(ClassMetadata classmetadata)
        {
#if CF || SILVERLIGHT
            return(false);
#else
            return(NetReflector.ToNative(classmetadata.ClassReflector()) == typeof(DateTimeOffset));
#endif
        }
Exemplo n.º 3
0
        public bool Match(IReflectClass classReflector)
        {
            var type = NetReflector.ToNative(classReflector);

            if (type == null)
            {
                return(false);
            }
            return(type.IsEnum);
        }
        protected override bool Accept(ClassMetadata classmetadata)
        {
            var isGuid = NetReflector.ToNative(classmetadata.ClassReflector()) == typeof(Guid);

            if (!isGuid)
            {
                classmetadata.TraverseDeclaredFields(reindexer);
            }
            return(isGuid);
        }
Exemplo n.º 5
0
        public bool Match(IReflectClass classReflector)
        {
            if (classReflector == null)
            {
                return(false);
            }
            Type type = NetReflector.ToNative(classReflector);

            return(type == typeof(System.Array));
        }
Exemplo n.º 6
0
 public bool Match(IReflectClass classReflector)
 {
     var type = NetReflector.ToNative(classReflector);
     if (type == null)
     {
         return false;
     }
     if (!type.IsGenericType)
     {
         return false;
     }
     return type.GetGenericTypeDefinition() == _genericType;
 }
            public bool Match(IReflectClass classReflector)
            {
                Type type = NetReflector.ToNative(classReflector);

                if (type == null)
                {
                    return(false);
                }
                if (!type.IsGenericType)
                {
                    return(false);
                }
                return(_type == type.GetGenericTypeDefinition());
            }
Exemplo n.º 8
0
            public bool Match(IReflectClass classReflector)
            {
                var type = NetReflector.ToNative(classReflector);

                if (type == null)
                {
                    return(false);
                }

                if (!type.IsGenericType)
                {
                    return(false);
                }
                return(((IList <Type>)_genericTypes).Contains(type.GetGenericTypeDefinition()));
            }
Exemplo n.º 9
0
        private static void ReindexDateTimeField(IStoredField field)
        {
            var claxx = field.GetStoredType();

            if (claxx == null)
            {
                return;
            }

            var t = NetReflector.ToNative(claxx);

            if (t == typeof(T) || t == typeof(T?))
            {
                field.DropIndex();
                field.CreateIndex();
            }
        }
Exemplo n.º 10
0
        public object Cast(object value)
        {
            System.Type type = NetReflector.ToNative(_type);
            if (null == type)
            {
                return(null);
            }

            if (IsNullable)
            {
                type = type.GetGenericArguments()[0];
            }

            return(type.IsEnum
                                                        ? ConvertEnum(type, value)
                                                        : Convert.ChangeType(value, type));
        }
Exemplo n.º 11
0
        internal static bool IsBuiltinCollectionClass(ReplicationReflector reflector, IReflectClass claxx)
        {
            Type type = NetReflector.ToNative(claxx);

            if (Contains(_nonGeneric, type))
            {
                return(true);
            }

            if (!type.IsGenericType)
            {
                return(false);
            }

            if (Contains(_generic, type.GetGenericTypeDefinition()))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 12
0
        protected override bool Accept(ClassMetadata classmetadata)
        {
            var type = NetReflector.ToNative(classmetadata.ClassReflector());

            return(type != null ? type.IsEnum : false);
        }
Exemplo n.º 13
0
 public bool CanHold(IReflectClass type)
 {
     return(NetReflector.ToNative(type).Equals(typeof(Guid)));
 }
Exemplo n.º 14
0
 protected override bool Accept(ClassMetadata classmetadata)
 {
     return(NetReflector.ToNative(classmetadata.ClassReflector()) == typeof(Guid));
 }