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


C# EndpointAttributes类代码示例

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


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

示例1: GenericHandler

 public GenericHandler(string contentType, EndpointAttributes handlerAttributes, Feature usesFeature)
 {
     this.HandlerContentType = contentType;
     this.ContentTypeAttribute = ContentType.GetEndpointAttributes(contentType);
     this.HandlerAttributes = handlerAttributes;
     this.usesFeature = usesFeature;
 }
开发者ID:rajeshpillai,项目名称:ServiceStack,代码行数:7,代码来源:GenericHandler.cs

示例2: GetRunTimeExecMethod

 public static MethodInfo GetRunTimeExecMethod(Type serviceType, Type requestType, EndpointAttributes attrs)
 {
     if ((attrs & EndpointAttributes.AsyncOneWay) == EndpointAttributes.AsyncOneWay)
     {
         var mi = serviceType.GetMethod(ExecuteAsync, new[] { requestType });
         if (mi != null) return mi;
     }
     else if ((attrs & EndpointAttributes.HttpGet) == EndpointAttributes.HttpGet)
     {
         var mi = serviceType.GetMethod(RestGet, new[] { requestType });
         if (mi != null) return mi;
     }
     else if ((attrs & EndpointAttributes.HttpPost) == EndpointAttributes.HttpPost)
     {
         var mi = serviceType.GetMethod(RestPost, new[] { requestType });
         if (mi != null) return mi;
     }
     else if ((attrs & EndpointAttributes.HttpPut) == EndpointAttributes.HttpPut)
     {
         var mi = serviceType.GetMethod(RestPut, new[] { requestType });
         if (mi != null) return mi;
     }
     else if ((attrs & EndpointAttributes.HttpDelete) == EndpointAttributes.HttpDelete)
     {
         var mi = serviceType.GetMethod(RestDelete, new[] { requestType });
         if (mi != null) return mi;
     }
     else if ((attrs & EndpointAttributes.HttpPatch) == EndpointAttributes.HttpPatch)
     {
         var mi = serviceType.GetMethod(RestPatch, new[] { requestType });
         if (mi != null) return mi;
     }
     return serviceType.GetMethod(Execute, new[] { requestType });
 }
开发者ID:austinvernsonger,项目名称:ServiceStack,代码行数:34,代码来源:ServiceExec.cs

示例3: GenericHandler

		public GenericHandler(string contentType, EndpointAttributes handlerAttributes, Feature format)
		{
			this.HandlerContentType = contentType;
			this.ContentTypeAttribute = ContentFormat.GetEndpointAttributes(contentType);
			this.HandlerAttributes = handlerAttributes;
			this.format = format;
		}
开发者ID:ELHANAFI,项目名称:ServiceStack,代码行数:7,代码来源:GenericHandler.cs

示例4: GetEndpointAttributes_AcceptsUserHostAddressFormats

        public void GetEndpointAttributes_AcceptsUserHostAddressFormats(string format, EndpointAttributes expected)
        {
            var handler = new TestHandler();
            var request = new Mock<IHttpRequest>();
            request.Expect(req => req.UserHostAddress).Returns(format);
            request.Expect(req => req.IsSecureConnection).Returns(false);
            request.Expect(req => req.HttpMethod).Returns("GET");

            Assert.AreEqual(expected | EndpointAttributes.HttpGet | EndpointAttributes.InSecure, request.Object.GetAttributes());
        }
开发者ID:mcguinness,项目名称:ServiceStack,代码行数:10,代码来源:EndpointHandlerBaseTests.cs

示例5: Create

        public static ICacheTextManager Create(EndpointAttributes endpointAttributes, ICacheClient cacheClient)
        {
            var isXml = (endpointAttributes & EndpointAttributes.Xml)
                        == EndpointAttributes.Xml;

            if (isXml) return new XmlCacheManager(cacheClient);

            var isJson = (endpointAttributes & EndpointAttributes.Json)
                        == EndpointAttributes.Json;

            if (isJson) return new JsonCacheManager(cacheClient);

            var isJsv = (endpointAttributes & EndpointAttributes.Jsv)
                        == EndpointAttributes.Jsv;

            if (isJsv) return new JsvCacheManager(cacheClient);

            throw new NotSupportedException("Only Xml, Json and Jsv CachTextManagers are supported");
        }
开发者ID:Wolfium,项目名称:ServiceStack-1,代码行数:19,代码来源:CacheTextManagerFactory.cs

示例6: WriteErrorToResponse

        public static void WriteErrorToResponse(this IHttpResponse response,
            EndpointAttributes contentType, string operationName, string errorMessage, Exception ex)
        {
            switch (contentType)
            {
                case EndpointAttributes.Xml:
                    WriteXmlErrorToResponse(response, operationName, errorMessage, ex);
                    break;

                case EndpointAttributes.Json:
                    WriteJsonErrorToResponse(response, operationName, errorMessage, ex);
                    break;

                case EndpointAttributes.Jsv:
                    WriteJsvErrorToResponse(response, operationName, errorMessage, ex);
                    break;

                default:
                    WriteXmlErrorToResponse(response, operationName, errorMessage, ex);
                    break;
            }
        }
开发者ID:firstsee,项目名称:ServiceStack,代码行数:22,代码来源:IHttpResponseExtensions.cs

示例7: GenericHandler

 protected GenericHandler(string contentType, EndpointAttributes handlerAttributes)
 {
     this.HandlerContentType = contentType;
     this.ContentTypeAttribute = ContentType.GetEndpointAttributes(contentType);
     this.HandlerAttributes = handlerAttributes;
 }
开发者ID:firstsee,项目名称:ServiceStack,代码行数:6,代码来源:GenericHandler.cs

示例8: ExecuteService

 internal static object ExecuteService(object request, EndpointAttributes endpointAttributes, IHttpRequest httpReq)
 {
     using (Profiler.Current.Step("Execute Service"))
     {
         return config.ServiceController.Execute(request,
             new HttpRequestContext(httpReq, request, endpointAttributes));
     }
 }
开发者ID:sbeparey,项目名称:ServiceStack,代码行数:8,代码来源:EndpointHost.cs

示例9: ToAllowedFlagsSet

        /// <summary>
        /// Returns the allowed set of scenarios based on the user-specified restrictions
        /// </summary>
        /// <param name="restrictToAny"></param>
        /// <returns></returns>
        private static EndpointAttributes[] ToAllowedFlagsSet(EndpointAttributes[] restrictToAny)
	    {
	        if (restrictToAny.Length == 0)
                return new[] { EndpointAttributes.Any };

	        var scenarios = new List<EndpointAttributes>();
	        foreach (var restrictToScenario in restrictToAny)
	        {
	            var restrictTo = restrictToScenario.ToAllowedFlagsSet();

	            scenarios.Add(restrictTo);
	        }

            return scenarios.ToArray();
	    }
开发者ID:jlyonsmith,项目名称:ServiceStack,代码行数:20,代码来源:RestrictAttribute.cs

示例10: CanAccess

        public bool CanAccess(EndpointAttributes reqAttrs, Format format, string operationName)
        {
            if (EndpointHost.Config != null && !EndpointHost.Config.EnableAccessRestrictions)
                return true;

            Operation operation;
            OperationNamesMap.TryGetValue(operationName.ToLower(), out operation);
            if (operation == null) return false;

            var canCall = HasImplementation(operation, format);
            if (!canCall) return false;

            if (operation.RestrictTo == null) return true;

            var allow = operation.RestrictTo.HasAccessTo(reqAttrs);
            if (!allow) return false;

            var allowsFormat = operation.RestrictTo.HasAccessTo((EndpointAttributes)(long)format);
            return allowsFormat;
        }
开发者ID:yeurch,项目名称:ServiceStack,代码行数:20,代码来源:ServiceMetadata.cs

示例11: ExecuteXmlService

 public virtual string ExecuteXmlService(string xmlRequest, EndpointAttributes endpointAttributes)
 {
     return (string)EndpointHost.Config.ServiceController.ExecuteText(
                    	xmlRequest, new HttpRequestContext(xmlRequest, endpointAttributes));
 }
开发者ID:Wolfium,项目名称:ServiceStack-1,代码行数:5,代码来源:HttpListenerBase.cs

示例12: ExecuteService

 internal static object ExecuteService(object request, EndpointAttributes endpointAttributes, IHttpRequest httpReq)
 {
     return config.ServiceController.Execute(request,
         new HttpRequestContext(httpReq, request, endpointAttributes));
 }
开发者ID:bahar,项目名称:ServiceStack,代码行数:5,代码来源:EndpointHost.cs

示例13: ExecuteService

 internal static object ExecuteService(object request, EndpointAttributes endpointAttributes)
 {
     AssertConfig();
     return Config.ServiceController.Execute(request,
         new HttpRequestContext(request, endpointAttributes));
 }
开发者ID:Wolfium,项目名称:ServiceStack-1,代码行数:6,代码来源:EndpointHost.cs

示例14: Soap12Handler

 public Soap12Handler(EndpointAttributes soapType) : base(soapType) { }
开发者ID:ELHANAFI,项目名称:ServiceStack,代码行数:1,代码来源:Soap12Handlers.cs

示例15: PortAttribute

 public PortAttribute(Type operationType, EndpointAttributes endpointAttributes, int version)
     : this(operationType, endpointAttributes)
 {
     this.Version = version;
 }
开发者ID:Wolfium,项目名称:ServiceStack-1,代码行数:5,代码来源:PortAttribute.cs


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