コード例 #1
0
 public DocumentDbDataSource(string name, DocumentDbConnectionInfo connectionInfo)
 {
     Name        = name;
     _databaseId = connectionInfo.DatabaseName;
     _key        = connectionInfo.Key;
     _uri        = connectionInfo.Uri;
 }
コード例 #2
0
        private static IConfigurationProvider CreateConfigurationProvider(IServiceProvider services)
        {
            var serviceContext = services.GetRequiredService <ServiceContext>();
            var configSection  = serviceContext.CodePackageActivationContext.GetConfigurationPackageObject("Config").Settings.Sections["ConfigurationConnection"];
            var connectionInfo = new DocumentDbConnectionInfo
            {
                DatabaseName = configSection.Parameters["DatabaseName"].Value,
                Key          = configSection.Parameters["Key"].Value,
                Uri          = new Uri(configSection.Parameters["Uri"].Value)
            };

            var dataSource = new DocumentDbDataSource("ConfigurationDataSource", connectionInfo);

            return(new DataSourceBackedConfigurationProvider(dataSource, services.GetRequiredService <ITransactionManager>()));
        }
コード例 #3
0
        public AuthenticationService(StatelessServiceContext context)
            : base(context)
        {
            var configSection  = context.CodePackageActivationContext.GetConfigurationPackageObject("Config").Settings.Sections["ConfigurationConnection"];
            var connectionInfo = new DocumentDbConnectionInfo
            {
                DatabaseName = configSection.Parameters["DatabaseName"].Value,
                Key          = configSection.Parameters["Key"].Value,
                Uri          = new Uri(configSection.Parameters["Uri"].Value)
            };

            var dbDataSource = new DocumentDbDataSource("Database", connectionInfo);

            _userRepository = new DataSourceRepository <UserAuthenticationInfo>
                                  (dbDataSource, "UserAuthenticationInfos");
        }