public AkkaPersistenceDataConnectionFactory(IProviderConfig <SnapshotTableConfiguration> config)
        {
            providerName = config.ProviderName;
            connString   = config.ConnectionString;
            //Build Mapping Schema to be used for all connections.
            //Make a unique mapping schema name here to avoid problems
            //with multiple configurations using different schemas.
            var configName = "akka.persistence.l2db." + HashCode.Combine(config.ConnectionString, config.ProviderName, config.TableConfig.GetHashCode());
            var ms         = new MappingSchema(configName, MappingSchema.Default);
            //ms.SetConvertExpression<DateTime, DateTime>(dt => DateTime.SpecifyKind(dt, DateTimeKind.Utc));
            var fmb = ms
                      .GetFluentMappingBuilder();

            MapSnapshotRow(config, fmb);

            useCloneDataConnection = config.UseCloneConnection;
            mappingSchema          = fmb.MappingSchema;
            opts = new LinqToDbConnectionOptionsBuilder()
                   .UseConnectionString(providerName, connString)
                   .UseMappingSchema(mappingSchema).Build();

            if (providerName.ToLower().StartsWith("sqlserver"))
            {
                policy = new SqlServerRetryPolicy();
            }
            _cloneConnection = new Lazy <DataConnection>(() => new DataConnection(opts));
        }
Ejemplo n.º 2
0
		public override void Initialize(string name, NameValueCollection config) {
			providerConfig = ConfigFactory.Create<LdapRoleProvider>(name, config);
			ldapConfig = providerConfig.LdapConfig;
			groupEntryAdapter = ldapConfig.Container.GroupEntryAdapter;
			userEntryAdapter = ldapConfig.Container.UserEntryAdapter;
			base.Initialize(providerConfig.Name, config);
		}
 public ByteArrayJournalSerializer(IProviderConfig <JournalTableConfig> journalConfig, Akka.Serialization.Serialization serializer, string separator)
 {
     _journalConfig  = journalConfig;
     _serializer     = serializer;
     _separator      = separator;
     _separatorArray = new[] { _separator };
 }
		public void SetUp() {
			providerConfig = A.Fake<IProviderConfig>();
			container = providerConfig.LdapConfig.Container;
			log = A.Fake<ILog>();
			A.CallTo(() => container.LogManager.GetLogger(typeof(LdapMembershipProvider))).Returns(log);
			InitializeProvider();
		}
Ejemplo n.º 5
0
 public override void Initialize(string name, NameValueCollection config)
 {
     providerConfig    = ConfigFactory.Create <LdapRoleProvider>(name, config);
     ldapConfig        = providerConfig.LdapConfig;
     groupEntryAdapter = ldapConfig.Container.GroupEntryAdapter;
     userEntryAdapter  = ldapConfig.Container.UserEntryAdapter;
     base.Initialize(providerConfig.Name, config);
 }
 public void SetUp()
 {
     providerConfig = A.Fake <IProviderConfig>();
     container      = providerConfig.LdapConfig.Container;
     log            = A.Fake <ILog>();
     A.CallTo(() => container.LogManager.GetLogger(typeof(LdapMembershipProvider))).Returns(log);
     InitializeProvider();
 }
Ejemplo n.º 7
0
		public override void Initialize(string name, NameValueCollection config) {
			providerConfig = ConfigFactory.Create<LdapMembershipProvider>(name, config);
			membershipUserFactory = providerConfig.MembershipUserFactory;
			usersConfig = providerConfig.LdapConfig.Users;
			userEntryAdapter = providerConfig.LdapConfig.Container.UserEntryAdapter;
			log = providerConfig.LdapConfig.Container.LogManager.GetLogger<LdapMembershipProvider>();
			base.Initialize(providerConfig.Name, config);
		}
Ejemplo n.º 8
0
 public override void Initialize(string name, NameValueCollection config)
 {
     providerConfig        = ConfigFactory.Create <LdapMembershipProvider>(name, config);
     membershipUserFactory = providerConfig.MembershipUserFactory;
     usersConfig           = providerConfig.LdapConfig.Users;
     userEntryAdapter      = providerConfig.LdapConfig.Container.UserEntryAdapter;
     log = providerConfig.LdapConfig.Container.LogManager.GetLogger <LdapMembershipProvider>();
     base.Initialize(providerConfig.Name, config);
 }
        public FileStorageConfiguration(IProviderConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            if (!(config is FileStorageConfig liteConfig))
            {
                throw new ArgumentException("Please provide FileStorageConfig instance", nameof(config));
            }

            Configuration = liteConfig;
        }
Ejemplo n.º 10
0
 public void AddProvider <TProvider> (TProvider provider, IProviderConfig providerConfig)
 {
     if (provider is ITermUrlProvider)
     {
         TermUrlProvidersInternal.Add((ITermUrlProvider)provider);
     }
     else if (provider is IDiscussProvider)
     {
         var discussProvider = (IDiscussProvider)provider;
         discussProvider.Params      = providerConfig.Params;
         discussProvider.ProviderKey = ((DiscussProviderConfig)providerConfig).ProviderKey;
         DiscussProviders_Internal.Add(discussProvider);
     }
 }
        private static void MapJournalRow(IProviderConfig <JournalTableConfig> config,
                                          FluentMappingBuilder fmb)
        {
            var tableConfig       = config.TableConfig;
            var journalRowBuilder = fmb.Entity <JournalRow>()
                                    .HasSchemaName(tableConfig.SchemaName)
                                    .HasTableName(tableConfig.TableName)
                                    .Member(r => r.deleted).HasColumnName(tableConfig.ColumnNames.Deleted)
                                    .Member(r => r.manifest).HasColumnName(tableConfig.ColumnNames.Manifest)
                                    .HasLength(500)
                                    .Member(r => r.message).HasColumnName(tableConfig.ColumnNames.Message).IsNullable(false)
                                    .Member(r => r.ordering).HasColumnName(tableConfig.ColumnNames.Ordering)
                                    .Member(r => r.tags).HasLength(100)
                                    .HasColumnName(tableConfig.ColumnNames.Tags)
                                    .Member(r => r.Identifier)
                                    .HasColumnName(tableConfig.ColumnNames.Identitifer)
                                    .Member(r => r.persistenceId)
                                    .HasColumnName(tableConfig.ColumnNames.PersistenceId).HasLength(255).IsNullable(false)
                                    .Member(r => r.sequenceNumber)
                                    .HasColumnName(tableConfig.ColumnNames.SequenceNumber)
                                    .Member(r => r.Timestamp)
                                    .HasColumnName(tableConfig.ColumnNames.Created);

            if (config.ProviderName.ToLower().Contains("sqlite"))
            {
                journalRowBuilder.Member(r => r.ordering).IsPrimaryKey().HasDbType("INTEGER")
                .IsIdentity();
            }
            else
            {
                journalRowBuilder.Member(r => r.ordering).IsIdentity()
                .Member(r => r.persistenceId).IsPrimaryKey()
                .Member(r => r.sequenceNumber).IsPrimaryKey();
            }

            //Probably overkill, but we only set Metadata Mapping if specified
            //That we are in delete compatibility mode.
            if (config.IDaoConfig.SqlCommonCompatibilityMode)
            {
                fmb.Entity <JournalMetaData>()
                .HasTableName(tableConfig.MetadataTableName)
                .HasSchemaName(tableConfig.SchemaName)
                .Member(r => r.PersistenceId)
                .HasColumnName(tableConfig.MetadataColumnNames.PersistenceId)
                .HasLength(255)
                .Member(r => r.SequenceNumber)
                .HasColumnName(tableConfig.MetadataColumnNames.SequenceNumber)
                ;
            }
        }
Ejemplo n.º 12
0
        // TODO: Remove around January 2015. Used to migrate legacy Local Category Path settings.
        public void MigrateLocalCategoryPath(Int32 downloadClientId, IProviderConfig newSettings, String host, OsPath remotePath, OsPath localPath)
        {
            _logger.Debug("Migrating local category path for Host {0}/{1} to {2}", host, remotePath, localPath);

            var existingMappings = All().Where(v => v.Host == host).ToList();

            if (!existingMappings.Any(v => new OsPath(v.LocalPath) == localPath && new OsPath(v.RemotePath) == remotePath))
            {
                Add(new RemotePathMapping {
                    Host = host, RemotePath = remotePath.FullPath, LocalPath = localPath.FullPath
                });
            }

            var downloadClient = _downloadClientRepository.Get(downloadClientId);

            downloadClient.Settings = newSettings;
            _downloadClientRepository.Update(downloadClient);
        }
        private static void MapSnapshotRow(
            IProviderConfig <SnapshotTableConfiguration> config,
            FluentMappingBuilder fmb)
        {
            var tableConfig = config.TableConfig;
            var builder     = fmb.Entity <SnapshotRow>()
                              .HasSchemaName(tableConfig.SchemaName)
                              .HasTableName(tableConfig.TableName)
                              .Member(r => r.Created)
                              .HasColumnName(tableConfig.ColumnNames.Created)
                              .Member(r => r.Manifest)
                              .HasColumnName(tableConfig.ColumnNames.Manifest)
                              .HasLength(500)
                              .Member(r => r.Payload)
                              .HasColumnName(tableConfig.ColumnNames.Snapshot)
                              .Member(r => r.SequenceNumber)
                              .HasColumnName(tableConfig.ColumnNames.SequenceNumber)
                              .Member(r => r.SerializerId)
                              .HasColumnName(tableConfig.ColumnNames.SerializerId)
                              .Member(r => r.PersistenceId)
                              .HasColumnName(tableConfig.ColumnNames.PersistenceId)
                              .HasLength(255);

            if (config.ProviderName.ToLower().Contains("sqlite") || config.ProviderName.ToLower().Contains("postgres"))
            {
                builder.Member(r => r.Created)
                .HasDataType(DataType.Int64)
                .HasConversion(r => r.Ticks, r => new DateTime(r));
            }
            if (config.IDaoConfig.SqlCommonCompatibilityMode)
            {
                //builder.Member(r => r.Created)
                //    .HasConversion(l => DateTimeHelpers.FromUnixEpochMillis(l),
                //        dt => DateTimeHelpers.ToUnixEpochMillis(dt));
            }
        }
Ejemplo n.º 14
0
 public IndexerSettingUpdatedEvent(string indexerName, IProviderConfig indexerSetting)
 {
     IndexerName = indexerName;
     IndexerSetting = indexerSetting;
 }
Ejemplo n.º 15
0
 public void SetUp()
 {
     providerConfig = A.Fake <IProviderConfig>();
     container      = providerConfig.LdapConfig.Container;
     InitializeProvider();
 }
Ejemplo n.º 16
0
 public IndexerSettingUpdatedEvent(string indexerName, IProviderConfig indexerSetting)
 {
     IndexerName    = indexerName;
     IndexerSetting = indexerSetting;
 }
Ejemplo n.º 17
0
		public void SetUp() {
			providerConfig = A.Fake<IProviderConfig>();
			container = providerConfig.LdapConfig.Container;
			InitializeProvider();
		}