private Guid ExecuteRequest(RegistrationTypeEnum registrationType, Guid Id, Entity entity) { if (Id != Guid.Empty) { entity.Id = Id; } if (registrationType == RegistrationTypeEnum.Upsert) { entity.Id = Id; var query = new QueryExpression(entity.LogicalName) { Criteria = new FilterExpression(), ColumnSet = new ColumnSet(columns: new[] { entity.LogicalName + "id" }) }; query.Criteria.AddCondition(entity.LogicalName + "id", ConditionOperator.Equal, Id); var ids = organizationService.RetrieveMultiple(query); if ((ids?.Entities.FirstOrDefault()?.Id ?? Guid.Empty) != Guid.Empty) { organizationService.Update(entity); } else { organizationService.Create(entity); } } else { Id = organizationService.Create(entity); } return(Id); }
public void Register(Type TClass, RegistrationTypeEnum registrationType) { var binder = _kernel.Bind(TClass).ToSelf(); if (registrationType == RegistrationTypeEnum.Singleton) { binder.InSingletonScope(); } }
public void Register(Type TClass, Type @interface, RegistrationTypeEnum registrationType) { var binder = _kernel.Bind(@interface).To(TClass); if (registrationType == RegistrationTypeEnum.Singleton) { binder.InSingletonScope(); } }
private LifetimeManager GetLifetimeManager(RegistrationTypeEnum registrationType) { switch (registrationType) { case RegistrationTypeEnum.Default: return(null); case RegistrationTypeEnum.Singleton: return(new ContainerControlledLifetimeManager()); } return(null); }
public void RegisterAsType(IRegistrationBuilder <object, ConcreteReflectionActivatorData, SingleRegistrationStyle> registrationBuilder, RegistrationTypeEnum registrationType) { switch (registrationType) { case RegistrationTypeEnum.Default: registrationBuilder.InstancePerDependency(); break; case RegistrationTypeEnum.Singleton: registrationBuilder.SingleInstance(); break; } }
/// <summary> /// Called by clients to register with the server. /// </summary> /// <param name="registrationType">The type of registration requested.</param> /// <param name="data">Information required to register with the server.</param> /// <returns>Results relating to the registration.</returns> public byte[] RegistrationChannel(RegistrationTypeEnum registrationType, byte[] data) { // ******** RECIEVED REGISTRATION REQUEST FROM CLIENT ******** var results = TransporterController.RegistrationController.TryAddDataFromRegistrationChannel(data, out IClientConfiguration clientConfiguration); // complete actual registering/unregistering if (clientConfiguration != null) { if (registrationType == RegistrationTypeEnum.Unregister) { // TODO: this is (-close-) to where the statistics for each client should be logged. // various problems exist: no logger, cannot execute a command while processing a command, ... // SEE: dodSON.Core.ComponentManagement.ComponentExtensionBase.OnStop() // dodSON.Core.ComponentManagement.ComponentPluginBase.OnStop() //// ######## THIS DOES NOT WORK ######## //Converters.TypeSerializer<ITransportStatistics> transportStatisticsConvertor = new Converters.TypeSerializer<ITransportStatistics>(); //var stats = transportStatisticsConvertor.FromByteArray( // TransporterController.TransportConfiguration.Compressor.Decompress( // TransporterController.TransportConfiguration.Encryptor.Decrypt( // _RegisteredCallbackClients[clientConfiguration.Id].CallbackClient.GetTransportStatistics()))); ////logs.Add(Logging.LogEntryType.Information, LogSourceId, $"^^^^ Shutting Down Client, Id={stats.ClientServerId}"); ////logs.Add(Logging.LogEntryType.Information, LogSourceId, $"^^^^ Total Incoming Bytes={Common.ByteCountHelper.ToString(stats.IncomingBytes)} ({stats.IncomingBytes:N0})"); ////logs.Add(Logging.LogEntryType.Information, LogSourceId, $"^^^^ Total Incoming Envelopes={stats.IncomingEnvelopes:N0}"); ////logs.Add(Logging.LogEntryType.Information, LogSourceId, $"^^^^ Total Outgoing Bytes={Common.ByteCountHelper.ToString(stats.OutgoingBytes)} ({stats.OutgoingBytes:N0})"); ////logs.Add(Logging.LogEntryType.Information, LogSourceId, $"^^^^ Total Outgoing Envelopes={stats.OutgoingEnvelopes:N0}"); ////logs.Add(Logging.LogEntryType.Information, LogSourceId, $"^^^^ Client Closed Successfully."); //// // unregister client Unregister(clientConfiguration.Id); } else { // register client Register(clientConfiguration); } } else { // TODO: missing client configuration; not sure what to do here } return(results); }
public void UpsertServiceEndpoints(List <ServiceEndpt> serviceEndptLst, string solutionName, RegistrationTypeEnum registrationType) { foreach (var serviceEndPt in serviceEndptLst) { logVerbose?.Invoke($"UpsertServiceEndpoint {serviceEndPt.Id} started"); var serviceEndpointId = UpsertServiceEndpoint(serviceEndPt, solutionName, registrationType); logVerbose?.Invoke($"UpsertServiceEndpoint {serviceEndpointId} completed"); foreach (var step in serviceEndPt.Steps) { var serviceEndpointRef = new EntityReference(ServiceEndpoint.EntityLogicalName, serviceEndpointId); logVerbose?.Invoke($"UpsertSdkMessageProcessingStep {step.Id} started"); var stepId = UpsertSdkMessageProcessingStep(serviceEndpointRef, step, solutionName, registrationType); logVerbose?.Invoke($"UpsertSdkMessageProcessingStep {stepId} completed"); foreach (var image in step.Images) { var stepRef = new EntityReference(SdkMessageProcessingStep.EntityLogicalName, stepId); logVerbose?.Invoke($"UpsertSdkMessageProcessingStepImage {image.Id} started"); var imageId = UpsertSdkMessageProcessingStepImage(stepId, image, solutionName, registrationType); logVerbose?.Invoke($"UpsertSdkMessageProcessingStepImage {imageId} completed"); } } } }
public void UpsertPluginTypeAndSteps(Guid parentId, Type pluginType, string solutionName, RegistrationTypeEnum registrationType) { Guid Id = pluginType.Id ?? Guid.Empty; if (Id == Guid.Empty) { Id = pluginRepository.GetPluginTypeId(parentId, pluginType.Name); logWarning?.Invoke($"Extracted id using plugin type name {pluginType.Name}"); } var type = new PluginType() { Name = pluginType.Name, Description = pluginType.Description, FriendlyName = pluginType.FriendlyName, TypeName = pluginType.TypeName, WorkflowActivityGroupName = pluginType.WorkflowActivityGroupName, PluginAssemblyId = new EntityReference(PluginAssembly.EntityLogicalName, parentId) }; Id = ExecuteRequest(registrationType, Id, type); // AddComponentToSolution(Id, ComponentType.PluginType, solutionName); logVerbose?.Invoke($"UpsertPluginType {Id} completed"); var typeRef = new EntityReference(PluginType.EntityLogicalName, Id); foreach (var step in pluginType.Steps) { var sdkMessageProcessingStepId = UpsertSdkMessageProcessingStep(typeRef, step, solutionName, registrationType); logVerbose?.Invoke($"Upsert SdkMessageProcessingStep {sdkMessageProcessingStepId} completed"); foreach (var image in step.Images) { var sdkMessageProcessingStepImageId = UpsertSdkMessageProcessingStepImage(sdkMessageProcessingStepId, image, solutionName, registrationType); logVerbose?.Invoke($"Upsert SdkMessageProcessingStepImage {sdkMessageProcessingStepImageId} completed"); } } }
public Guid UpsertPluginAssembly(Assembly pluginAssembly, AssemblyInfo assemblyInfo, string solutionName, RegistrationTypeEnum registrationType) { Guid Id = pluginAssembly?.Id ?? Guid.Empty; if (Id == Guid.Empty) { Id = pluginRepository.GetPluginAssemblyId(assemblyInfo.AssemblyName); logWarning?.Invoke($"Extracted id using plugin assembly name {assemblyInfo.AssemblyName}"); } var assembly = new PluginAssembly() { Version = assemblyInfo.Version, Content = assemblyInfo.Content, Name = assemblyInfo.AssemblyName, SourceTypeEnum = PluginAssembly_SourceType.Database, IsolationModeEnum = PluginAssembly_IsolationMode.Sandbox, }; if (pluginAssembly != null) { assembly.SourceTypeEnum = pluginAssembly.SourceType; assembly.IsolationModeEnum = pluginAssembly.IsolationMode; } if (!Id.Equals(Guid.Empty) && registrationType == RegistrationTypeEnum.Reset) { DeleteObjectWithDependencies(Id, ComponentType.PluginAssembly); } logVerbose?.Invoke($"Trying to upsert {assemblyInfo.AssemblyName} / {Id}"); Id = ExecuteRequest(registrationType, Id, assembly); AddComponentToSolution(Id, ComponentType.PluginAssembly, solutionName); return(Id); }
public Registration(TransientRegistration transientRegistration) { _registrationType = RegistrationTypeEnum.Transient; _value = transientRegistration; }
public Registration(FactoryRegistration factoryRegistration) { _registrationType = RegistrationTypeEnum.Factory; _value = factoryRegistration; }
public void Register(Type TClass, Type @interface, RegistrationTypeEnum registrationType = RegistrationTypeEnum.Default) { RegisterAsType(_containerBuilder.RegisterType(TClass).As(@interface), registrationType); }
private Guid UpsertSdkMessageProcessingStepImage(Guid parentId, Image image, string solutionName, RegistrationTypeEnum registrationType) { Guid Id = image.Id ?? Guid.Empty; if (Id == Guid.Empty) { Id = pluginRepository.GetSdkMessageProcessingStepImageId(parentId, image.EntityAlias, image.ImageType); logWarning?.Invoke($"Extracted id using plugin step image name {image.EntityAlias}"); } var sdkMessageProcessingStepImage = new SdkMessageProcessingStepImage() { Attributes1 = image.Attributes, EntityAlias = image.EntityAlias, MessagePropertyName = image.MessagePropertyName, ImageTypeEnum = image.ImageType, SdkMessageProcessingStepId = new EntityReference(SdkMessageProcessingStep.EntityLogicalName, parentId) }; Id = ExecuteRequest(registrationType, Id, sdkMessageProcessingStepImage); return(Id); }
private Guid UpsertSdkMessageProcessingStep(Guid parentId, Step step, string solutionName, RegistrationTypeEnum registrationType) { Guid Id = step.Id ?? Guid.Empty; if (Id == Guid.Empty) { Id = pluginRepository.GetSdkMessageProcessingStepId(parentId, step.Name); logWarning?.Invoke($"Extracted id using plugin step name {step.Name}"); } var sdkMessageId = pluginRepository.GetSdkMessageId(step.MessageName); var sdkMessageFilterId = pluginRepository.GetSdkMessageFilterId(step.PrimaryEntityName, sdkMessageId); var sdkMessageProcessingStep = new SdkMessageProcessingStep() { Name = step.Name, Description = step.Description, SdkMessageId = new EntityReference(SdkMessage.EntityLogicalName, sdkMessageId), Configuration = step.CustomConfiguration, FilteringAttributes = step.FilteringAttributes, ImpersonatingUserId = new EntityReference(SystemUser.EntityLogicalName, pluginRepository.GetUserId(step.ImpersonatingUserFullname)), ModeEnum = step.Mode, SdkMessageFilterId = new EntityReference(SdkMessageFilter.EntityLogicalName, sdkMessageFilterId), Rank = step.Rank, StageEnum = step.Stage, SupportedDeploymentEnum = step.SupportedDeployment, EventHandler = new EntityReference(PluginType.EntityLogicalName, parentId), }; Id = ExecuteRequest(registrationType, Id, sdkMessageProcessingStep); AddComponentToSolution(Id, ComponentType.SDKMessageProcessingStep, solutionName); return(Id); }
public void Register(Type TClass, RegistrationTypeEnum registrationType) { RegisterAsType(_containerBuilder.RegisterType(TClass).AsSelf(), registrationType); }
private Guid UpsertServiceEndpoint(ServiceEndpt serviceEndpt, string solutionName, RegistrationTypeEnum registrationType) { Guid Id = serviceEndpt?.Id ?? Guid.Empty; if (Id == Guid.Empty) { Id = pluginRepository.GetServiceEndpointId(serviceEndpt.Name); logWarning?.Invoke($"Extracted id using plugin assembly name {serviceEndpt.Name}"); } var serviceEndpoint = new ServiceEndpoint() { Name = serviceEndpt.Name, NamespaceAddress = serviceEndpt.NamespaceAddress, ContractEnum = serviceEndpt.Contract, Path = serviceEndpt.Path, MessageFormatEnum = serviceEndpt.MessageFormat, AuthTypeEnum = serviceEndpt.AuthType, SASKeyName = serviceEndpt.SASKeyName, SASKey = serviceEndpt.SASKey, SASToken = serviceEndpt.SASToken, UserClaimEnum = serviceEndpt.UserClaim, Description = serviceEndpt.Description, Url = serviceEndpt.Url, AuthValue = serviceEndpt.AuthValue, }; if (!Id.Equals(Guid.Empty) && registrationType == RegistrationTypeEnum.Reset) { DeleteObjectWithDependencies(Id, ComponentType.ServiceEndpoint); } logVerbose?.Invoke($"Trying to upsert {serviceEndpt.Name} / {Id}"); Id = ExecuteRequest(registrationType, Id, serviceEndpoint); AddComponentToSolution(Id, ComponentType.ServiceEndpoint, solutionName); return(Id); }
public DependencyInjectionRegisterAttribute(RegistrationTypeEnum registrationType) { _registrationType = registrationType; }
public Guid UpsertSdkMessageProcessingStep(EntityReference parentRef, Step step, string solutionName, RegistrationTypeEnum registrationType) { Guid Id = step.Id ?? Guid.Empty; if (Id == Guid.Empty) { Id = pluginRepository.GetSdkMessageProcessingStepId(parentRef.Id, step.Name); logWarning?.Invoke($"Extracted id using plugin step name {step.Name}"); } var sdkMessageId = pluginRepository.GetSdkMessageId(step.MessageName); var sdkMessageFilterId = pluginRepository.GetSdkMessageFilterId(step.PrimaryEntityName, sdkMessageId); var sdkMessageProcessingStep = new SdkMessageProcessingStep() { Name = step.Name, Description = step.Description, SdkMessageId = new EntityReference(SdkMessage.EntityLogicalName, sdkMessageId), Configuration = step.CustomConfiguration, FilteringAttributes = step.FilteringAttributes, ImpersonatingUserId = new EntityReference(SystemUser.EntityLogicalName, pluginRepository.GetUserId(step.ImpersonatingUserFullname)), ModeEnum = step.Mode, SdkMessageFilterId = sdkMessageFilterId.Equals(Guid.Empty) ? null : new EntityReference(SdkMessageFilter.EntityLogicalName, sdkMessageFilterId), Rank = step.Rank, StageEnum = step.Stage, SupportedDeploymentEnum = step.SupportedDeployment, EventHandler = parentRef, AsyncAutoDelete = step.AsyncAutoDelete, }; Id = ExecuteRequest(registrationType, Id, sdkMessageProcessingStep); int stateCode = (int)step.StateCode; organizationService.Execute(new SetStateRequest { EntityMoniker = new EntityReference(sdkMessageProcessingStep.LogicalName, Id), State = new OptionSetValue(stateCode), Status = new OptionSetValue(stateCode + 1) }); AddComponentToSolution(Id, ComponentType.SDKMessageProcessingStep, solutionName); return(Id); }
public void SetRegistrationType(RegistrationTypeEnum registrationType) { RegistrationType = registrationType.ToString(); }
public Registration(SingletonRegistration singletonRegistration) { _registrationType = RegistrationTypeEnum.Singleton; _value = singletonRegistration; }
public Registration(DelegateRegistration delegateRegistration) { _registrationType = RegistrationTypeEnum.Delegate; _value = delegateRegistration; }
public DependencyInjectionRegisterAttribute() { _registrationType = RegistrationTypeEnum.Default; }
public void Register(Type TClass, RegistrationTypeEnum registrationType) { _container.RegisterType(TClass, GetLifetimeManager(registrationType)); }