Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the BaseMemoryContext class, using the specified assemblies for interfaces and implementation.
 /// </summary>
 protected BaseMemoryContext(InterfaceType.Factory iftFactory)
 {
     this.objects         = new ContextCache <int>(this, item => item.ID);
     this.iftFactoryCache = new FuncCache <Type, InterfaceType>(t => iftFactory(t));
     this._iftFactory     = t => iftFactoryCache.Invoke(t);
     ZetboxContextDebuggerSingleton.Created(this);
 }
Ejemplo n.º 2
0
 public MemoryContext(InterfaceType.Factory iftFactory, Func <IFrozenContext> lazyCtx, MemoryImplementationType.MemoryFactory implTypeFactory)
     : base(iftFactory)
 {
     _lazyCtx = lazyCtx;
     _implTypeFactoryCache = new FuncCache <Type, MemoryImplementationType>(t => implTypeFactory(t));
     _implTypeFactory      = t => _implTypeFactoryCache.Invoke(t);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the BaseZetboxDataContext class using the specified <see cref="Identity"/>.
        /// </summary>
        /// <param name="metaDataResolver">the IMetaDataResolver for this context.</param>
        /// <param name="identity">the identity of this context. if this is null, the context does no security checks</param>
        /// <param name="config"></param>
        /// <param name="lazyCtx"></param>
        /// <param name="iftFactory"></param>
        protected BaseZetboxDataContext(IMetaDataResolver metaDataResolver, Identity identity, ZetboxConfig config, Func <IFrozenContext> lazyCtx, InterfaceType.Factory iftFactory)
        {
            if (metaDataResolver == null)
            {
                throw new ArgumentNullException("metaDataResolver");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (iftFactory == null)
            {
                throw new ArgumentNullException("iftFactory");
            }

            this.metaDataResolver = metaDataResolver;
            this.identityStore    = identity;
            this.config           = config;
            this.iftFactoryCache  = new FuncCache <Type, InterfaceType>(r => iftFactory(r));
            this.iftFactory       = t => iftFactoryCache.Invoke(t);
            this.lazyCtx          = lazyCtx;
        }