public static ExtendedProperty Create(PropertyInfo property, ExtendedResourceInfo declaringTypeInfo)
 {
     return
         ((ExtendedAttributeProperty)
          createMethod.MakeGenericMethod(declaringTypeInfo.DictValueType, property.PropertyType)
          .Invoke(null, new object[] { property, declaringTypeInfo }));
 }
 protected ExtendedOverlayProperty(PropertyInfo property,
                                   PropertyInfo underlyingProperty,
                                   ExtendedResourceInfo info)
     : base(property)
 {
     UnderlyingProperty = underlyingProperty;
     Info = info;
 }
 protected ExtendedOverlayProperty(PropertyInfo property,
                                   PropertyInfo underlyingProperty,
                                   ExtendedResourceInfo info)
     : base(property)
 {
     UnderlyingProperty = underlyingProperty;
     Info = info;
 }
Exemple #4
0
 internal ExtendedQueryableRoot(IClientTypeResolver client,
                                IQueryable wrappedSource,
                                ExtendedResourceInfo extendedResourceInfo,
                                ExtendedResourceMapper extendedResourceMapper)
     : base(new ExtendedQueryProvider(extendedResourceMapper), null)
 {
     WrappedSource        = wrappedSource;
     ExtendedResourceInfo = extendedResourceInfo;
 }
        private static IList <TExtended> CreateProxyList <TExtended, TServer>(IEnumerable source,
                                                                              ExtendedResourceInfo userTypeInfo)
            where TExtended : TServer, IClientResource
            where TServer : IClientResource
        {
#if DISABLE_PROXY_GENERATION
            throw new NotSupportedException("Proxy generation has been disabled compile-time using DISABLE_PROXY_GENERATION, which makes this method not supported.");
#else
            return(new ExtendedResourceList <TExtended, TServer>((IList <TServer>)source, userTypeInfo));
#endif
        }
 public ExtendedResourceList(IList <TServer> wrappedList, ExtendedResourceInfo userTypeInfo)
 {
     if (wrappedList == null)
     {
         throw new ArgumentNullException(nameof(wrappedList));
     }
     if (userTypeInfo == null)
     {
         throw new ArgumentNullException(nameof(userTypeInfo));
     }
     this.wrappedList = wrappedList;
     UserTypeInfo     = userTypeInfo;
 }
        private object CreateClientSideResourceProxy(ExtendedResourceInfo userTypeInfo,
                                                     object wrappedResource)
        {
#if DISABLE_PROXY_GENERATION
            throw new NotSupportedException("Proxy generation has been disabled compile-time using DISABLE_PROXY_GENERATION, which makes this method not supported.");
#else
            var proxy =
                (ExtendedResourceBase)
                RuntimeProxyFactory.Create(typeof(ExtendedResourceBase <>).MakeGenericType(userTypeInfo.ServerType),
                                           userTypeInfo.ExtendedType);
            proxy.Initialize(this.clientTypeResolver, userTypeInfo, wrappedResource);
            return(proxy);
#endif
        }
        private ExtendedResourceInfo GetExtendedResourceInfoOrNull(Type clientType)
        {
            ExtendedResourceInfo info = null;
            var serverTypeInfo        = this.clientTypeResolver.GetMostInheritedResourceInterfaceInfo(clientType);

            if (!clientType.IsInterface || serverTypeInfo == null)
            {
                return(null);
            }

            var serverType = serverTypeInfo.InterfaceType;

            if (serverType == clientType)
            {
                return(null);
            }

            var dictProperty = GetAttributesDictionaryPropertyFromResource(serverType);

            info = new ExtendedResourceInfo(clientType, serverType, dictProperty, this);
            return(info);
        }
Exemple #9
0
 private bool IsUserType(Type userType, out ExtendedResourceInfo userTypeInfo)
 {
     return(this.mapper.TryGetExtendedResourceInfo(userType, out userTypeInfo));
 }
Exemple #10
0
 public ExtendedComplexOverlayProperty(PropertyInfo property,
                                       PropertyInfo underlyingProperty,
                                       ExtendedResourceInfo info)
     : base(property, underlyingProperty, info)
 {
 }
 public ExtendedComplexOverlayProperty(PropertyInfo property,
                                       PropertyInfo underlyingProperty,
                                       ExtendedResourceInfo info)
     : base(property, underlyingProperty, info)
 {
 }
 private static ExtendedProperty Create <TDictValue, TProperty>(PropertyInfo property,
                                                                ExtendedResourceInfo declaringTypeInfo)
 {
     return(new ExtendedAttributeProperty <TDictValue, TProperty>(property, declaringTypeInfo));
 }
 internal bool TryGetExtendedResourceInfo(Type clientType, out ExtendedResourceInfo info)
 {
     info = this.extendedResourceInfoCache.GetOrAdd(clientType, t => GetExtendedResourceInfoOrNull(clientType));
     return(info != null);
 }
 public IQueryable <T> WrapQueryable <T>(IQueryable wrappedQueryable, ExtendedResourceInfo extendedResourceInfo)
 {
     return(new ExtendedQueryableRoot <T>(this.clientTypeResolver, wrappedQueryable, extendedResourceInfo, this));
 }