Esempio n. 1
0
 public SetCollectionProxySealed(IRuntimeProxyFacade facade, Guid instanceId, Boolean readOnly)
 {
     this.elementTypeId  = StaticProxyFacade.Instance.GetTypeId(typeof(TElementType));
     this.isScalar       = StaticProxyFacade.Instance.IsScalarType(elementTypeId);
     this.__instanceId__ = instanceId;
     this.__readOnly__   = readOnly;
     this.__facade__     = facade;
 }
Esempio n. 2
0
        public DictionaryProxy(IRuntimeProxyFacade facade, Guid instanceId, Boolean readOnly)
        {
            this.__facade__     = facade;
            this.__readOnly__   = readOnly;
            this.__instanceId__ = instanceId;

            Guid elementTypeId = StaticProxyFacade.Instance.GetTypeId(typeof(TValue));

            this.isScalar = StaticProxyFacade.Instance.IsScalarType(elementTypeId);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates new proxy instance for a given instance id
        /// </summary>
        /// <param name="facade">Runtime facade visible to proxy</param>
        /// <param name="instanceId">Instance ID</param>
        /// <param name="typeId">Type ID</param>
        /// <param name="readOnly">Defines if proxy should be read only</param>
        /// <returns>Instance of the proxy</returns>
        public object NewObject(IRuntimeProxyFacade facade, Guid typeId, Guid instanceId, bool readOnly)
        {
            Type proxyType = proxyTypesFromIDs[typeId];

            return(Activator.CreateInstance(proxyType, new object[] { facade, instanceId, readOnly }));

            // TODO (nsabo) Optimize if newer framework is used by using the Expression:

            /*
             * Func<IRuntimeProxyFacade, Guid, bool, object> constructor = null;
             *
             * if (constructors.ContainsKey(typeId))
             * {
             *  constructor=(Func<IRuntimeProxyFacade, Guid, bool, object>)constructors[typeId];
             * }
             * else
             * {
             *  constructor = GetConstructor(proxyType);
             *  constructors.Add(typeId, constructor);
             * }
             *
             * return constructor(facade, instanceId, readOnly);
             */
        }
Esempio n. 4
0
        /// <summary>
        /// Creates new proxy instance for a given instance id
        /// </summary>
        /// <typeparam name="T">Type of the entity interface</typeparam>
        /// <param name="facade">Runtime facade visible to proxy</param>
        /// <param name="instanceId">Instance ID</param>
        /// <param name="readOnly">Defines if proxy should be read only</param>
        /// <returns>Instance of the proxy</returns>
        public T NewObject <T>(IRuntimeProxyFacade facade, Guid instanceId, bool readOnly)
        {
            Type proxyType = proxyTypesFromInterfaces[typeof(T)];

            return((T)Activator.CreateInstance(proxyType, new object[] { facade, instanceId, readOnly }));
        }
Esempio n. 5
0
 public ProxySample(IRuntimeProxyFacade facade, Guid instanceId, Boolean readOnly)
 {
     this.instanceId = instanceId;
     this.readOnly = readOnly;
     this.facade = facade;
 }
Esempio n. 6
0
 public ProxySample(IRuntimeProxyFacade facade, Guid instanceId, Boolean readOnly)
 {
     this.instanceId = instanceId;
     this.readOnly   = readOnly;
     this.facade     = facade;
 }