本文整理汇总了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;
}
示例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 });
}
示例3: GenericHandler
public GenericHandler(string contentType, EndpointAttributes handlerAttributes, Feature format)
{
this.HandlerContentType = contentType;
this.ContentTypeAttribute = ContentFormat.GetEndpointAttributes(contentType);
this.HandlerAttributes = handlerAttributes;
this.format = format;
}
示例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());
}
示例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");
}
示例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;
}
}
示例7: GenericHandler
protected GenericHandler(string contentType, EndpointAttributes handlerAttributes)
{
this.HandlerContentType = contentType;
this.ContentTypeAttribute = ContentType.GetEndpointAttributes(contentType);
this.HandlerAttributes = handlerAttributes;
}
示例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));
}
}
示例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();
}
示例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;
}
示例11: ExecuteXmlService
public virtual string ExecuteXmlService(string xmlRequest, EndpointAttributes endpointAttributes)
{
return (string)EndpointHost.Config.ServiceController.ExecuteText(
xmlRequest, new HttpRequestContext(xmlRequest, endpointAttributes));
}
示例12: ExecuteService
internal static object ExecuteService(object request, EndpointAttributes endpointAttributes, IHttpRequest httpReq)
{
return config.ServiceController.Execute(request,
new HttpRequestContext(httpReq, request, endpointAttributes));
}
示例13: ExecuteService
internal static object ExecuteService(object request, EndpointAttributes endpointAttributes)
{
AssertConfig();
return Config.ServiceController.Execute(request,
new HttpRequestContext(request, endpointAttributes));
}
示例14: Soap12Handler
public Soap12Handler(EndpointAttributes soapType) : base(soapType) { }
示例15: PortAttribute
public PortAttribute(Type operationType, EndpointAttributes endpointAttributes, int version)
: this(operationType, endpointAttributes)
{
this.Version = version;
}