Пример #1
0
 /// <summary>
 /// Register the initial services.
 /// </summary>
 /// <param name="serviceLocator">The current singleton service locator.</param>
 internal static void Register(Nequeo.Runtime.IServiceLocator serviceLocator)
 {
     serviceLocator.Register <IEmployee>(locator => new Nequeo.Service.NequeoCompany.Employee());
     serviceLocator.Register <ICustomer>(locator => new Nequeo.Service.NequeoCompany.Customer());
     serviceLocator.Register <IAccount>(locator => new Nequeo.Service.NequeoCompany.Account());
     serviceLocator.Register <ICompany>(locator => new Nequeo.Service.NequeoCompany.Company());
     serviceLocator.Register <IAsset>(locator => new Nequeo.Service.NequeoCompany.Asset());
     serviceLocator.Register <IProduct>(locator => new Nequeo.Service.NequeoCompany.Product());
     serviceLocator.Register <IVendor>(locator => new Nequeo.Service.NequeoCompany.Vendor());
     serviceLocator.Register <IUser>(locator => new Nequeo.Service.NequeoCompany.User());
     serviceLocator.Register <IManage>(locator => new Nequeo.Service.NequeoCompany.Manage());
 }
Пример #2
0
        /// <summary>
        /// Gets the Component Factory for the extended UI.
        /// </summary>
        /// <param name="helper">The MVC html helper to extend.</param>
        /// <returns>The compoent factory reference for each UI.</returns>
        public static Extended.ComponentFactory NequeoUI(this HtmlHelper helper)
        {
            // If the instance object is null.
            if (helper == null)
            {
                throw new System.ArgumentNullException("helper");
            }

            ViewContext     viewContext = helper.ViewContext;
            HttpContextBase httpContext = viewContext.HttpContext;

            Extended.ComponentFactory factory = httpContext.Items[KeyExtended] as Extended.ComponentFactory;

            if (factory == null)
            {
                // Get the current service locator singleton instance.
                Nequeo.Runtime.IServiceLocator locator = Extended.Factory.Runtime.ServiceLocator.Current;
                Extended.Factory.Runtime.ServiceLocator.Register(locator);

                // Collect information on the current page
                // including all style sheets and scripts
                // that may already be added, do not add these
                // style sheets or scripts if already present.
                Extended.WebAsset.IWebAssetItemMerger           assetItemMerger = locator.Resolve <Extended.WebAsset.IWebAssetItemMerger>();
                Extended.UI.ScriptWrapperBase                   scriptWrapper   = locator.Resolve <Extended.UI.ScriptWrapperBase>();
                Extended.Factory.IClientSideObjectWriterFactory clientSideObjectWriterFactory =
                    locator.Resolve <Extended.Factory.IClientSideObjectWriterFactory>();

                Extended.UI.StyleSheetRegistrar styleSheetRegistrar = new Extended.UI.StyleSheetRegistrar(
                    new Extended.WebAsset.WebAssetItemCollection(Extended.WebAsset.WebAssetDefaultSettings.StyleSheetFilesPath),
                    viewContext, assetItemMerger);

                Extended.UI.ScriptRegistrar scriptRegistrar = new Extended.UI.ScriptRegistrar(
                    new Extended.WebAsset.WebAssetItemCollection(Extended.WebAsset.WebAssetDefaultSettings.ScriptFilesPath),
                    new List <Extended.Factory.IScriptableComponent>(), viewContext, assetItemMerger, scriptWrapper);

                Extended.UI.StyleSheetRegistrarBuilder styleSheetRegistrarBuilder = new Extended.UI.StyleSheetRegistrarBuilder(styleSheetRegistrar);
                Extended.UI.ScriptRegistrarBuilder     scriptRegistrarBuilder     = new Extended.UI.ScriptRegistrarBuilder(scriptRegistrar);

                // Execute the component factory.
                factory = new Extended.ComponentFactory(helper, clientSideObjectWriterFactory, styleSheetRegistrarBuilder, scriptRegistrarBuilder);
                helper.ViewContext.HttpContext.Items[KeyExtended] = factory;
            }

            // Return the compoent factory instance.
            return(factory);
        }
Пример #3
0
 /// <summary>
 /// Register the initial services.
 /// </summary>
 /// <param name="serviceLocator">The current singleton service locator.</param>
 internal static void Register(Nequeo.Runtime.IServiceLocator serviceLocator)
 {
     serviceLocator.Register <RouteCollection>(locator => RouteTable.Routes);
     serviceLocator.Register <IVirtualPathProvider>(locator => new VirtualPathProviderWrapper());
     serviceLocator.Register <IPathResolver>(locator => new PathResolver());
     serviceLocator.Register <ICacheManager>(locator => new CacheManagerWrapper());
     serviceLocator.Register <IUrlResolver>(locator => new UrlResolver());
     serviceLocator.Register <IUrlEncoder>(locator => new UrlEncoder());
     serviceLocator.Register <IConfigurationManager>(locator => new ConfigurationManagerWrapper());
     serviceLocator.Register <IHttpResponseCacher>(locator => new HttpResponseCacher());
     serviceLocator.Register <IHttpResponseCompressor>(locator => new HttpResponseCompressor());
     serviceLocator.Register <IWebAssetLocator>(locator => new WebAssetLocator(false, locator.Resolve <IVirtualPathProvider>()));
     serviceLocator.Register <IWebAssetRegistry>(locator => new WebAssetRegistry(false, locator.Resolve <ICacheManager>(), locator.Resolve <IWebAssetLocator>(), locator.Resolve <IUrlResolver>(), locator.Resolve <IPathResolver>(), locator.Resolve <IVirtualPathProvider>()));
     serviceLocator.Register <IWebAssetItemMerger>(locator => new WebAssetItemMerger(locator.Resolve <IWebAssetRegistry>(), locator.Resolve <IUrlResolver>(), locator.Resolve <IUrlEncoder>()));
     serviceLocator.Register <IClientSideObjectWriterFactory>(locator => new ClientSideObjectWriterFactory());
     serviceLocator.Register <ScriptWrapperBase>(locator => new ScriptWrapper());
 }
Пример #4
0
 /// <summary>
 /// Register the current service locator services.
 /// </summary>
 public static void RegisterCurrent()
 {
     // Get the current service locator singleton instance.
     Nequeo.Runtime.IServiceLocator locator = Nequeo.Service.NequeoCompany.ServiceLocator.Current;
     Nequeo.Service.NequeoCompany.ServiceLocator.Register(locator);
 }