예제 #1
0
        public ActionResult Image(string location, string id)
        {
            Response.Cache.SetOmitVaryStar(true);
            IContractFactory <IResourceAccess> builder = Actor.Public.GetNamedExport <IContractFactory <IResourceAccess> >(location);

            if (builder.IsNull())
            {
                return(Content("no resource"));
            }
            return(File(builder.Build().GetImage(id), "image/png"));
        }
예제 #2
0
        public static IEntityRequestProcess BuildEntityProcessor(this Public Public, string ProviderName)
        {
            Lazy <IContractFactory <IEntityRequestProcess> > factoryLazy = _founderAgent.EntityProcessorBox.FirstOrDefault(f => f.Metadata.ProviderName.Equals(ProviderName, StringComparison.InvariantCultureIgnoreCase));
            IContractFactory <IEntityRequestProcess>         factory     = factoryLazy.Value;

            if (factory != default(IContractFactory <IEntityRequestProcess>))
            {
                return(factory.Build());
            }
            return(default(IEntityRequestProcess));
        }
예제 #3
0
        public ActionResult Script(string location, string id)
        {
            Response.Cache.SetOmitVaryStar(true);
            IContractFactory <IResourceAccess> builder = Actor.Public.GetNamedExport <IContractFactory <IResourceAccess> >(location);

            if (builder.IsNull())
            {
                return(Content("no resource"));
            }
            return(Content(builder.Build().GetScript(id), "text/javascript"));
        }
예제 #4
0
        public static T BuildContractProvider <T>(this Public Public) where T : class
        {
            object obj = default(IContractFactory <T>);

            if (MEFPool.TryGetValue(typeof(IContractFactory <T>), out obj) && obj is IContractFactory <T> )
            {
                IContractFactory <T> builder = obj as IContractFactory <T>;
                return(builder.Build().AsDecorator());
            }
            return(default(T));
        }