当前位置: 首页>>代码示例>>C#>>正文


C# Web.UmbracoContext类代码示例

本文整理汇总了C#中Umbraco.Web.UmbracoContext的典型用法代码示例。如果您正苦于以下问题:C# UmbracoContext类的具体用法?C# UmbracoContext怎么用?C# UmbracoContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UmbracoContext类属于Umbraco.Web命名空间,在下文中一共展示了UmbracoContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: XmlRssHandler

 public XmlRssHandler()
 {
     umbContext = UmbracoContext.Current;
     appContext = ApplicationContext.Current;
     services = appContext.Services;
     helper = new UmbracoHelper( umbContext );
 }
开发者ID:rasmuseeg,项目名称:UmbracoFeed,代码行数:7,代码来源:XmlRssHandler.cs

示例2: ProductVariantApiController

 /// <summary>
 /// This is a helper contructor for unit testing
 /// </summary>
 internal ProductVariantApiController(MerchelloContext merchelloContext, UmbracoContext umbracoContext)
     : base(merchelloContext, umbracoContext)
 {
     _productService = MerchelloContext.Services.ProductService;
     _productVariantService = MerchelloContext.Services.ProductVariantService;
     _warehouseService = MerchelloContext.Services.WarehouseService;
 }
开发者ID:BatJan,项目名称:Merchello,代码行数:10,代码来源:ProductVariantApiController.cs

示例3: SetUp

		public void SetUp()
		{
			TestHelper.SetupLog4NetForTests();
			Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false;
			_httpContextFactory = new FakeHttpContextFactory("~/Home");
			//ensure the StateHelper is using our custom context
			StateHelper.HttpContext = _httpContextFactory.HttpContext;
			
			_umbracoContext = new UmbracoContext(_httpContextFactory.HttpContext, 
				new ApplicationContext(), 
				new DefaultRoutesCache(false));

			_umbracoContext.GetXmlDelegate = () =>
				{
					var xDoc = new XmlDocument();

					//create a custom xml structure to return

					xDoc.LoadXml(GetXml());
					//return the custom x doc
					return xDoc;
				};

			_publishedContentStore = new DefaultPublishedContentStore();			
		}
开发者ID:elrute,项目名称:Triphulcas,代码行数:25,代码来源:PublishContentStoreTests.cs

示例4: BeginRequest

		/// <summary>
		/// Begins to process a request.
		/// </summary>
		/// <param name="httpContext"></param>
		void BeginRequest(HttpContextBase httpContext)
		{
			// do not process if client-side request
			if (IsClientSideRequest(httpContext.Request.Url))
				return;			

			// ok, process

			// create the LegacyRequestInitializer
			// and initialize legacy stuff
			var legacyRequestInitializer = new LegacyRequestInitializer(httpContext.Request.Url, httpContext);
			legacyRequestInitializer.InitializeRequest();

			// create the UmbracoContext singleton, one per request, and assign
			var umbracoContext = new UmbracoContext(
				httpContext,
				ApplicationContext.Current,
				RoutesCacheResolver.Current.RoutesCache);
			UmbracoContext.Current = umbracoContext;

			// create the nice urls provider
			var niceUrls = new NiceUrlProvider(PublishedContentStoreResolver.Current.PublishedContentStore, umbracoContext);

			// create the RoutingContext, and assign
			var routingContext = new RoutingContext(
				umbracoContext,
				DocumentLookupsResolver.Current.DocumentLookups,
				LastChanceLookupResolver.Current.LastChanceLookup,
				PublishedContentStoreResolver.Current.PublishedContentStore,
				niceUrls);
			umbracoContext.RoutingContext = routingContext;
		}
开发者ID:elrute,项目名称:Triphulcas,代码行数:36,代码来源:UmbracoModule.cs

示例5: FindContent

        protected override sealed IPublishedContent FindContent(RequestContext requestContext, UmbracoContext umbracoContext)
        {
            var byId = umbracoContext.ContentCache.GetById(_realNodeId);
            if (byId == null) return null;

            return FindContent(requestContext, umbracoContext, byId);
        }
开发者ID:BenFidge,项目名称:Articulate,代码行数:7,代码来源:UmbracoVirtualNodeByIdRouteHandler.cs

示例6: OrderApiController

 /// <summary>
 /// Initializes a new instance of the <see cref="OrderApiController"/> class.
 /// </summary>
 /// <param name="merchelloContext">
 /// The merchello context.
 /// </param>
 /// <param name="umbracoContext">
 /// The umbraco context.
 /// </param>
 internal OrderApiController(IMerchelloContext merchelloContext, UmbracoContext umbracoContext)
     : base(merchelloContext, umbracoContext)
 {
     _orderService = merchelloContext.Services.OrderService;
     _invoiceService = merchelloContext.Services.InvoiceService;
     _merchello = new MerchelloHelper(merchelloContext.Services);
 }
开发者ID:ProNotion,项目名称:Merchello,代码行数:16,代码来源:OrderApiController.cs

示例7: CatalogShippingApiController

 /// <summary>
 /// This is a helper contructor for unit testing
 /// </summary>
 internal CatalogShippingApiController(MerchelloContext merchelloContext, UmbracoContext umbracoContext)
     : base(merchelloContext, umbracoContext)
 {
     _gatewayProviderService = MerchelloContext.Services.GatewayProviderService;
     _storeSettingService = MerchelloContext.Services.StoreSettingService;
     _shipCountryService = ((ServiceContext)MerchelloContext.Services).ShipCountryService;
 }
开发者ID:naepalm,项目名称:Merchello,代码行数:10,代码来源:CatalogShippingApiController.cs

示例8: UmbracoUserControl

         /// <summary>
		/// Default constructor
		/// </summary>
		/// <param name="umbracoContext"></param>
		protected UmbracoUserControl(UmbracoContext umbracoContext)
		{
            if (umbracoContext == null) throw new ArgumentNullException("umbracoContext");
            UmbracoContext = umbracoContext;
            InstanceId = Guid.NewGuid();
            Umbraco = new UmbracoHelper(umbracoContext);
		}
开发者ID:Jeavon,项目名称:Umbraco-CMS,代码行数:11,代码来源:UmbracoUserControl.cs

示例9: FormsController

 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="context">Umbraco context.</param>
 public FormsController(UmbracoContext context)
     : base(context)
 {
     Persistence = FormPersistence.Current.Manager;
     Entities = EntityPersistence.Current.Manager;
     Validations = ValidationPersistence.Current.Manager;
 }
开发者ID:Vrijdagonline,项目名称:formulate,代码行数:11,代码来源:FormsController.cs

示例10: Crawl

        /// <summary>
        /// The crawl.
        /// </summary>
        /// <param name="site">
        /// The site.
        /// </param>
        /// <param name="doc">
        /// The doc.
        /// </param>
        public void Crawl(UmbracoContext site, XmlDocument doc)
        {
            /*
             *  We're going to crawl the site layer-by-layer which will put the upper levels
             *  of the site nearer the top of the sitemap.xml document as opposed to crawling
             *  the tree by parent/child relationships, which will go deep on each branch before
             *  crawling the entire site.
             */

            var helper = new UmbracoHelper(UmbracoContext.Current);
            var siteRoot = helper.TypedContentAtRoot().First();
            var node = SitemapGenerator.CreateNode(siteRoot, site);
            if (node.IsPage && node.IsListedInNavigation && node.ShouldIndex)
            {
                SitemapGenerator.AppendUrlElement(doc, node);
            }

            var items = siteRoot.Descendants();
            if (items != null)
            {
                foreach (var item in items)
                {
                    node = SitemapGenerator.CreateNode(item, site);

                    if (node.IsPage && node.IsListedInNavigation && node.ShouldIndex)
                    {
                        SitemapGenerator.AppendUrlElement(doc, node);
                    }
                }
            }
        }
开发者ID:MattSchroer,项目名称:constellation.umbraco.seo,代码行数:40,代码来源:DefaultCrawler.cs

示例11: FindContent

        protected override sealed IPublishedContent FindContent(RequestContext requestContext, UmbracoContext umbracoContext)
        {
            //determine if it's for a particular domain
            int realNodeId;
            if (_hostsAndIds.Count == 1)
            {
                realNodeId = _hostsAndIds[0].Item2;
            }
            else
            {
                if (requestContext.HttpContext.Request.Url == null)
                {
                    if (_hostsAndIds.Count > 0)
                    {
                        //cannot be determined
                        realNodeId = _hostsAndIds[0].Item2;
                    }
                    else
                    {
                        LogHelper.Warn<ArticulateVirtualNodeByIdRouteHandler>("No entries found to map hosts and IDs");
                        return null;
                    }
                }
                else if (requestContext.HttpContext.Request.Url.Host.InvariantEquals("localhost")
                    && !UmbracoConfig.For.UmbracoSettings().RequestHandler.UseDomainPrefixes)
                {
                    //TODO: Why is this checking for UseDomainPrefixes + localhost? I can't figure that part out (even though i wrote that)

                    var found = _hostsAndIds.FirstOrDefault(x => x.Item1 == string.Empty);
                    if (found != null)
                    {
                        realNodeId = found.Item2;
                    }
                    else
                    {
                        LogHelper.Warn<ArticulateVirtualNodeByIdRouteHandler>("No entries found in hosts/IDs map with an empty Host value. Values: " + DebugHostIdsCollection());
                        return null;
                    }
                }
                else
                {
                    var found = _hostsAndIds.FirstOrDefault(x => x.Item1.InvariantEquals(requestContext.HttpContext.Request.Url.Host));
                    if (found != null)
                    {
                        realNodeId = found.Item2;
                    }
                    else
                    {
                        LogHelper.Warn<ArticulateVirtualNodeByIdRouteHandler>("No entries found in hosts/IDs map with a Host value of " + requestContext.HttpContext.Request.Url.Host + ". Values: " + DebugHostIdsCollection());
                        return null;
                    }
                }
            }

            var byId = umbracoContext.ContentCache.GetById(realNodeId);
            if (byId == null) return null;

            return FindContent(requestContext, umbracoContext, byId);
        }
开发者ID:simonech,项目名称:Articulate,代码行数:59,代码来源:ArticulateVirtualNodeByIdRouteHandler.cs

示例12: MarketingApiController

        /// <summary>
        /// Initializes a new instance of the <see cref="MarketingApiController"/> class.
        /// </summary>
        /// <param name="merchelloContext">
        /// The merchello context.
        /// </param>
        /// <param name="umbracoContext">
        /// The umbraco context.
        /// </param>
        internal MarketingApiController(IMerchelloContext merchelloContext, UmbracoContext umbracoContext)
            : base(merchelloContext, umbracoContext)
        {
            _offerSettingsService = merchelloContext.Services.OfferSettingsService;

            // TODO - this need to be fixed to make testable
            this._providerResolver = OfferProviderResolver.Current;
        }
开发者ID:drpeck,项目名称:Merchello,代码行数:17,代码来源:MarketingApiController.cs

示例13: ShipmentApiController

 /// <summary>
 /// This is a helper contructor for unit testing
 /// </summary>
 internal ShipmentApiController(IMerchelloContext merchelloContext, UmbracoContext umbracoContext)
     : base((MerchelloContext) merchelloContext, umbracoContext)
 {
     _shipmentService = merchelloContext.Services.ShipmentService;
     _invoiceService = merchelloContext.Services.InvoiceService;
     _orderService = merchelloContext.Services.OrderService;
     _shipMethodService = ((ServiceContext)merchelloContext.Services).ShipMethodService;
 }
开发者ID:kedde,项目名称:Merchello,代码行数:11,代码来源:ShipmentApiController.cs

示例14: MerchelloApiController

        protected MerchelloApiController(MerchelloContext merchelloContext, UmbracoContext umbracoContext)
            : base(umbracoContext)
        {
            Mandate.ParameterNotNull(merchelloContext, "merchelloContext");

            MerchelloContext = merchelloContext;
            InstanceId = Guid.NewGuid();
        }
开发者ID:naepalm,项目名称:Merchello,代码行数:8,代码来源:MerchelloApiController.cs

示例15: GetNode

		/// <summary>
		/// Shared with PublishMediaStoreTests
		/// </summary>
		/// <param name="id"></param>
		/// <param name="umbracoContext"></param>
		/// <returns></returns>
		internal static IPublishedContent GetNode(int id, UmbracoContext umbracoContext)
		{
			var ctx = umbracoContext;
			var mediaStore = new DefaultPublishedMediaStore();
			var doc = mediaStore.GetDocumentById(ctx, id);
			Assert.IsNotNull(doc);
			return doc;
		}
开发者ID:phaniarveti,项目名称:Experiments,代码行数:14,代码来源:PublishedMediaTests.cs


注:本文中的Umbraco.Web.UmbracoContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。