Пример #1
0
        /// <summary>
        ///     Creates a new instance.
        /// </summary>
        /// <param name="getRepository">The function to produce the repository.</param>
        /// <param name="sessionFactory">The factory to produce sessions to pass into the given repository.</param>
        /// <param name="policy">The transaction commit policy.</param>
        public UnitOfWorkLinq(
            Func <ISession, IRepositoryLinq <TEntity, TKey> > getRepository,
            ISessionFactory sessionFactory,
            ICommitPolicy policy = null)
            : base(sessionFactory, policy)
        {
            Guard.ArgumentNotNull(getRepository, nameof(getRepository));

            _entitySet = new EntitySetLinq <TEntity, TKey>(this, getRepository);
        }
Пример #2
0
 public ElasticSearchUpdateContext(ElasticSearchIndex elasticSearchIndex, ElasticClient esClient, ICommitPolicy commitPolicy, ICommitPolicyExecutor commitPolicyExecutor)
     : this(elasticSearchIndex, esClient)
 {
     if (commitPolicy != null && commitPolicyExecutor == null)
     {
         throw new ArgumentNullException("commitPolicyExecutor");
     }
     CommitPolicy          = commitPolicy;
     _commitPolicyExecutor = (commitPolicy != null) ? commitPolicyExecutor : new NullCommitPolicyExecutor();
 }
Пример #3
0
        /// <summary>
        ///     Creates a new instance.
        /// </summary>
        /// <param name="sessionFactory">The underlying data session factory to use.</param>
        /// <param name="policy">The policy to use when committing changes.</param>
        public UnitOfWork(
            ISessionFactory sessionFactory,
            ICommitPolicy policy = null)
            : base(sessionFactory)
        {
            Guard.ArgumentNotNull(sessionFactory, nameof(sessionFactory));

            _executionQueue = new Queue <Action>();

            // do not implement a transaction save commit policy by default
            _commitPolicy = policy ?? new CommitPolicyNoOp();
        }
Пример #4
0
 public FsUnitOfWork(
     ISessionFactory sessionFactory,
     Func <ISession, IRepositoryLinq <BusinessUnit, Guid> > getBusinessUnits,
     Func <ISession, IRepositoryLinq <DesignDomain, Guid> > getDesignDomains,
     Func <ISession, IRepositoryLinq <LifeCycle, string> > getLifeCycles,
     Func <ISession, IRepositoryLinq <Policy, Guid> > getPolicies,
     Func <ISession, IRepositoryLinq <Project, Guid> > getProjects,
     Func <ISession, IRepositoryLinq <Scenario, Guid> > getScenarios,
     Func <ISession, IRepositoryLinq <ProtocolType, string> > getProtocolTypes,
     Func <ISession, IRepositoryLinq <Protocol, Guid> > getProtocols,
     Func <ISession, IRepositoryLinq <Stakeholder, Guid> > getStakeholders,
     Func <ISession, IRepositoryLinq <StakeholderLogin, Guid> > getStakeholderLogins,
     Func <ISession, IRepositoryLinq <UserGroup, Guid> > userGroupsGet,
     Func <ISession, IRepositoryLinq <UserGroupMembership, Guid> > getUserGroupMemberships,
     Func <ISession, IRepositoryLinq <SoftwareModel, Guid> > getSoftwareModels,
     Func <ISession, IRepositoryLinq <SoftwareModelDependency, Guid> > getSoftwareModelDependency,
     Func <ISession, IRepositoryLinq <SoftwareModelInterface, Guid> > getSoftwareModelInterfaces,
     Func <ISession, IRepositoryLinq <Device, Guid> > getDevices,
     Func <ISession, IRepositoryLinq <DeviceModelDependency, Guid> > getDeviceModelDependencies,
     Func <ISession, IRepositoryLinq <DeviceModel, Guid> > getDeviceModels,
     Func <ISession, IRepositoryLinq <DeviceConnection, Guid> > getDeviceConnections,
     Func <ISession, IRepositoryLinq <ApplicationAccess, Guid> > getApplicationAccess,
     Func <ISession, IRepositoryLinq <Reference, Guid> > getRefererences,
     Func <ISession, IRepositoryLinq <Capability, Guid> > getCapabilities,
     Func <ISession, IRepositoryLinq <Network, Guid> > getNetworks,
     ICommitPolicy commitPolicy) : base(getApplicationAccess, sessionFactory, commitPolicy)
 {
     this.Networks                  = new EntitySetLinq <Network, Guid>(this, getNetworks);
     this.Protocols                 = new EntitySetLinq <Protocol, Guid>(this, getProtocols);
     this.ProtocolTypes             = new EntitySetLinq <ProtocolType, string>(this, getProtocolTypes);
     this.Policies                  = new EntitySetLinq <Policy, Guid>(this, getPolicies);
     this.Capabilities              = new EntitySetLinq <Capability, Guid>(this, getCapabilities);
     this.LifeCycles                = new EntitySetLinq <LifeCycle, string>(this, getLifeCycles);
     this.Projects                  = new EntitySetLinq <Project, Guid>(this, getProjects);
     this.Scenarios                 = new EntitySetLinq <Scenario, Guid>(this, getScenarios);
     this.DesignDomains             = new EntitySetLinq <DesignDomain, Guid>(this, getDesignDomains);
     this.Devices                   = new EntitySetLinq <Device, Guid>(this, getDevices);
     this.DeviceModelDependencies   = new EntitySetLinq <DeviceModelDependency, Guid>(this, getDeviceModelDependencies);
     this.DeviceModels              = new EntitySetLinq <DeviceModel, Guid>(this, getDeviceModels);
     this.DeviceConnections         = new EntitySetLinq <DeviceConnection, Guid>(this, getDeviceConnections);
     this.Stakeholders              = new EntitySetLinq <Stakeholder, Guid>(this, getStakeholders);
     this.SoftwareModels            = new EntitySetLinq <SoftwareModel, Guid>(this, getSoftwareModels);
     this.SoftwareModelInterfaces   = new EntitySetLinq <SoftwareModelInterface, Guid>(this, getSoftwareModelInterfaces);
     this.SoftwareModelDependencies = new EntitySetLinq <SoftwareModelDependency, Guid>(this, getSoftwareModelDependency);
     this.StakeholderLogins         = new EntitySetLinq <StakeholderLogin, Guid>(this, getStakeholderLogins);
     this.UserGroupMemberships      = new EntitySetLinq <UserGroupMembership, Guid>(this, getUserGroupMemberships);
     this.UserGroups                = new EntitySetLinq <UserGroup, Guid>(this, userGroupsGet);
     this.References                = new EntitySetLinq <Reference, Guid>(this, getRefererences);
     this.ApplicationAccess         = new EntitySetLinq <ApplicationAccess, Guid>(this, getApplicationAccess);
     this.BusinessUnits             = new EntitySetLinq <BusinessUnit, Guid>(this, getBusinessUnits);
 }
    protected AbstractFileMapping([NotNull] XmlElement mappingElement, [NotNull] string databaseName)
      : base(mappingElement, databaseName)
    {
      var fileName = mappingElement.GetAttribute("file");
      Assert.IsNotNullOrEmpty(fileName, $"The \"file\" attribute is not specified or has empty string value: {mappingElement.OuterXml}");

      var filePath = MainUtil.MapPath(fileName);
      Assert.IsNotNullOrEmpty(filePath, nameof(filePath));

      var media = mappingElement.GetAttribute("media");
      var intervalText = mappingElement.GetAttribute("interval");

      this.VirtualPath = fileName;
      this.FileMappingPath = filePath;
      this.MediaFolderPath = !string.IsNullOrEmpty(media) ? MainUtil.MapPath(media) : null;
      this.CommitPolicy = CommitPolicyFactory.GetCommitPolicy(intervalText, this.DoCommit);
    }
   public AzureUpdateContext(ISearchIndex index, ICommitPolicy commitPolicy, ICommitPolicyExecutor commitPolicyExecutor)
 : this(index, commitPolicyExecutor)
   {
   }
 public AzureUpdateContext(ISearchIndex index, ICommitPolicy commitPolicy, ICommitPolicyExecutor commitPolicyExecutor)
     : this(index, commitPolicyExecutor)
 {
 }