public static List <BreadCrumbItem> GetTrail(this IServiceDescription self) { return(new List <BreadCrumbItem> { ConfigSet(self.ConfigSet) }); }
public static IServiceDescription CreateChild(this IServiceDescription service, ConfigurationContext context, ref IConfigSet configSet) { var child = context.ServiceDescriptions.Create(); child.Name = service.Name; child.ConfigSetNameId = configSet.Id; child.ConfigSet = configSet; child.PatentServiceDescription = service; service.ChildServiceDescriptions.Add(child); context.SaveChanges(); foreach (var endpoint in service.Endpoints) { var newEndpoint = endpoint.CreateChild(context, ref child); child.Endpoints.Add(newEndpoint); } foreach (var environment in configSet.Environments) { var addressOverride = string.Format("{0}_Address", service.Name); var overrideProp = environment.SubstitutionParameters.SingleOrDefault(x => String.Equals(x.Name, addressOverride, StringComparison.OrdinalIgnoreCase)); if (overrideProp.IsNull()) { environment.CreateSubstitutionParameters(context, addressOverride); } } return(child); }
public IServiceResult GetORIsOfService(IServiceDescription serviceDescription, ExecuteServiceDelegate executeServiceDelegate) { if (!UseResultCache) { return(executeServiceDelegate.Invoke(serviceDescription)); } ServiceResultCacheKey key = BuildKey(serviceDescription); IServiceResult serviceResult; lock (serviceCallToPendingResult) { serviceResult = serviceCallToResult.Get(key); if (serviceResult != null) { return(CreateServiceResult(serviceResult)); } while (serviceCallToPendingResult.Contains(key)) { Monitor.Wait(serviceCallToPendingResult); } serviceResult = serviceCallToResult.Get(key); if (serviceResult != null) { return(CreateServiceResult(serviceResult)); } serviceCallToPendingResult.Add(key); } bool success = false; try { if (SecurityActivation != null) { serviceResult = SecurityActivation.ExecuteWithoutFiltering(new IResultingBackgroundWorkerDelegate <IServiceResult>(delegate() { return(executeServiceDelegate.Invoke(serviceDescription)); })); } else { serviceResult = executeServiceDelegate.Invoke(serviceDescription); } success = true; } finally { lock (serviceCallToPendingResult) { serviceCallToPendingResult.Remove(key); if (success) { serviceCallToResult.Put(key, serviceResult); } Monitor.PulseAll(serviceCallToPendingResult); } } return(CreateServiceResult(serviceResult)); }
public IEndpoint CreateEndpoint(IServiceDescription service, string endpointname, List <string> parameters = null) { var endpoint = service.CreateEndpoint(Repository, endpointname, false, parameters); endpoint.ServiceDescription.ConfigSet.LastUpdate = DateTime.UtcNow; Repository.SaveChanges(); return(endpoint); }
private static BreadCrumbItem ServiceDescription(IServiceDescription self) { return(new BreadCrumbItem { Url = string.Format("/Service/Details/edit?item={0}", self.Id), Name = self.Name }); }
public IServiceResult GetORIsForServiceRequest(IServiceDescription serviceDescription) { ICacheService cacheService = nameToCacheServiceMap.GetExtension(serviceDescription.ServiceName); if (cacheService == null) { throw new ArgumentException("No cache service registered for with name '" + serviceDescription.ServiceName + "'"); } return(cacheService.GetORIsForServiceRequest(serviceDescription)); }
private static void AddToChildren(IServiceDescription service, ConfigurationContext context, IEndpoint endpoint) { foreach (var child in service.ChildServiceDescriptions) { var c = child; var childEndpoint = endpoint.CreateChild(context, ref c); child.Endpoints.Add(childEndpoint); context.SaveChanges(); AddToChildren(c, context, childEndpoint); } }
protected ServiceResultCacheKey BuildKey(IServiceDescription serviceDescription) { Object service = ServiceByNameProvider.GetService(serviceDescription.ServiceName); ServiceResultCacheKey key = new ServiceResultCacheKey(); key.Arguments = serviceDescription.Arguments; key.Method = serviceDescription.GetMethod(service.GetType()); key.ServiceName = serviceDescription.ServiceName; if (key.Method == null || key.ServiceName == null) { throw new ArgumentException("ServiceDescription not legal " + serviceDescription); } return(key); }
public IServiceResult GetORIsForServiceRequest(IServiceDescription serviceDescription) { Object service = ServiceByNameProvider.GetService(serviceDescription.ServiceName); if (service == null) { throw new Exception("Service with name '" + serviceDescription.ServiceName + "' not found"); } Object result = serviceDescription.GetMethod(service.GetType()).Invoke(service, serviceDescription.Arguments); IList <IObjRef> objRefs = OriHelper.ExtractObjRefList(result, null); ServiceResult serviceResult = new ServiceResult(); serviceResult.ObjRefs = objRefs; return(serviceResult); }
private static void CreateSubstitutionParameters(IServiceDescription service, ConfigurationContext context, string endpointName, IEndpoint endpoint) { if (endpointName == "custom") { foreach (var environment in service.ConfigSet.Environments) { foreach (var param in endpoint.Parameters) { var addressOverride = string.Format("{0}_{1}", service.Name, param.Name); var overrideProp = environment.SubstitutionParameters.SingleOrDefault(x => string.Equals(x.Name, addressOverride, StringComparison.OrdinalIgnoreCase)); if (overrideProp.IsNull()) { environment.CreateSubstitutionParameters(context, addressOverride); } } } } }
public static void AddServiceParameters(IServiceDescription service, ConfigurationContext context, IEndpoint endpoint, Dictionary <string, string> wcfServiceParameters) { foreach (var serviceParameter in wcfServiceParameters.Keys) { var parameter = context.EndpointParameters.Create(); parameter.Name = serviceParameter; parameter.EndpointNameId = endpoint.Id; parameter.Endpoint = endpoint; parameter.ConfigurableForEachEnvironment = ParameterIsEnvironmental(serviceParameter, endpoint.Name); parameter.IsPerService = ParameterIsEnvironmentalPrService(serviceParameter); if (!string.Equals(endpoint.Name, "custom", StringComparison.OrdinalIgnoreCase)) { parameter.ItemValue = serviceParameter == "Address" ? string.Format("{0}{1}.svc/{2}", wcfServiceParameters[serviceParameter], service.Name, endpoint.Name) : wcfServiceParameters[serviceParameter]; } else { parameter.ItemValue = "{0}"; } endpoint.Parameters.Add(parameter); } }
protected override Object InterceptApplication(IInvocation invocation, Attribute annotation, Boolean?isAsyncBegin) { bool oldProcessServiceActive = processServiceActiveTL.Value; if (oldProcessServiceActive || ProcessService == null || !AnnotationUtil.IsAnnotationPresent <ServiceClientAttribute>(invocation.Method.DeclaringType, false)) { return(base.InterceptApplication(invocation, annotation, isAsyncBegin)); } ISecurityScope[] securityScopes = SecurityScopeProvider.SecurityScopes; IServiceDescription serviceDescription = SyncToAsyncUtil.CreateServiceDescription(ServiceName, invocation.Method, invocation.Arguments, securityScopes); processServiceActiveTL.Value = true; try { return(ProcessService.InvokeService(serviceDescription)); } finally { processServiceActiveTL.Value = oldProcessServiceActive; } }
public static IEndpoint CreateEndpoint(this IServiceDescription service, ConfigurationContext context, string endpointName, bool ignoreParameters = false, List <string> parameters = null) { var endpoint = context.Endpoints.Create(); endpoint.Name = endpointName; endpoint.ServiceNameId = service.Id; if (service.Endpoints.Count == 0) { service.ClientEndpointValue = endpoint.Name; } if (!ignoreParameters) { var cParam = CustomServiceParameters; if (parameters.IsInstance()) { cParam = parameters.ToDictionary(s => s, v => "{0}"); } AddServiceParameters(service, context, endpoint, string.Equals(endpointName, "custom", StringComparison.OrdinalIgnoreCase) ? cParam : WcfServiceParameters); } service.Endpoints.Add(endpoint); context.SaveChanges(); CreateSubstitutionParameters(service, context, endpointName, endpoint); return(endpoint); }
public void DeleteService(IServiceDescription service) { Repository.DeleteObject(service); Repository.SaveChanges(); }
public void UpdateService(IServiceDescription service) { service.ConfigSet.LastUpdate = DateTime.UtcNow; Repository.SaveChanges(); }
private static BreadCrumbItem ServiceDescription(IServiceDescription self) { return new BreadCrumbItem { Url = string.Format("/Service/Details/edit?item={0}", self.Id), Name = self.Name }; }
private static void AddToChildren(IConfigSet configSet, ConfigurationContext context, IServiceDescription service) { foreach (var childConfigSet in configSet.ChildConfigSets) { var c = childConfigSet; var child = service.CreateChild(context, ref c); c.Services.Add(child); AddToChildren(c, context, child); } }
public static IEndpoint CreateChild(this IEndpoint endpoint, ConfigurationContext context, ref IServiceDescription service) { var child = context.Endpoints.Create(); child.Name = endpoint.Name; child.ServiceNameId = service.Id; child.ServiceDescription = service; context.SaveChanges(); foreach (var endpointParameter in endpoint.Parameters) { var parameter = CreateChild(endpointParameter, context, child); child.Parameters.Add(parameter); } return child; }
private static void CreateSubstitutionParameters(IServiceDescription service, ConfigurationContext context, string endpointName, IEndpoint endpoint) { if (endpointName == "custom") { foreach (var environment in service.ConfigSet.Environments) { foreach (var param in endpoint.Parameters) { var addressOverride = string.Format("{0}_{1}", service.Name, param.Name); var overrideProp = environment.SubstitutionParameters.SingleOrDefault(x => string.Equals(x.Name, addressOverride, StringComparison.OrdinalIgnoreCase)); if (overrideProp.IsNull()) environment.CreateSubstitutionParameters(context, addressOverride); } } } }
public StoreController(IServiceCatogory service, IServiceItem serviceItem, IServiceDescription serviceDescription) { this.serviceCategory = service; this.serviceItem = serviceItem; this.serviceDescription = serviceDescription; }
public static bool UserHasAccessTo(this IServiceDescription self) { return(self.ConfigSet.UserHasAccessTo()); }
public virtual Object CallServiceInSecurityScope(ISecurityScope[] securityScopes, IServiceDescription serviceDescription) { SecurityScope[] param1WCF = new SecurityScope[securityScopes.Length]; for (int a = securityScopes.Length; a-- > 0;) { param1WCF[a] = (SecurityScope)securityScopes[a]; } Object resultWCF = SecurityServiceWCF.CallServiceInSecurityScope(param1WCF, (ServiceDescription)serviceDescription); return(resultWCF); }
public ManagerController(IServiceCatogory serviceCatogory, IServiceManager serviceManager, IServiceDescription serviceDescription) { this.serviceDescription = serviceDescription; this.serviceCatogory = serviceCatogory; this.serviceManager = serviceManager; }
public static void AddServiceParameters(IServiceDescription service, ConfigurationContext context, IEndpoint endpoint, Dictionary<string, string> wcfServiceParameters) { foreach (var serviceParameter in wcfServiceParameters.Keys) { var parameter = context.EndpointParameters.Create(); parameter.Name = serviceParameter; parameter.EndpointNameId = endpoint.Id; parameter.Endpoint = endpoint; parameter.ConfigurableForEachEnvironment = ParameterIsEnvironmental(serviceParameter, endpoint.Name); parameter.IsPerService = ParameterIsEnvironmentalPrService(serviceParameter); if (!string.Equals(endpoint.Name, "custom", StringComparison.OrdinalIgnoreCase)) { parameter.ItemValue = serviceParameter == "Address" ? string.Format("{0}{1}.svc/{2}", wcfServiceParameters[serviceParameter], service.Name, endpoint.Name) : wcfServiceParameters[serviceParameter]; } else { parameter.ItemValue = "{0}"; } endpoint.Parameters.Add(parameter); } }
public IEndpoint CreateEndpoint(IServiceDescription service, string endpointname, List<string> parameters = null) { var endpoint = service.CreateEndpoint(Repository, endpointname, false, parameters); endpoint.ServiceDescription.ConfigSet.LastUpdate = DateTime.UtcNow; Repository.SaveChanges(); return endpoint; }
public static IEndpoint CreateChild(this IEndpoint endpoint, ConfigurationContext context, ref IServiceDescription service) { var child = context.Endpoints.Create(); child.Name = endpoint.Name; child.ServiceNameId = service.Id; child.ServiceDescription = service; context.SaveChanges(); foreach (var endpointParameter in endpoint.Parameters) { var parameter = CreateChild(endpointParameter, context, child); child.Parameters.Add(parameter); } return(child); }
private void ConnectToHost(ServiceRegistrationServer.ServiceRegistrationMessage data, IConfigSet cs, IServiceDescription service) { if (data.ServiceHost != null) { var host = cs.ServiceHosts.SingleOrDefault(s => s.Name == data.ServiceHost); if (host != null) { service.ServiceHost = host; service.ServiceHostId = host.Id; configSetTasks.UpdateService(service); } } }