protected BaseConfiguration() { ProviderCollection <StorageProviderDefinition> storageProviderDefinitionCollection = StorageProviderDefinitionObjectMother.CreateTestDomainStorageProviders(); _storageConfiguration = new StorageConfiguration( storageProviderDefinitionCollection, storageProviderDefinitionCollection[DatabaseTest.DefaultStorageProviderID]); _storageConfiguration.StorageGroups.Add( new StorageGroupElement( new TestDomainAttribute(), DatabaseTest.c_testDomainProviderID)); _storageConfiguration.StorageGroups.Add( new StorageGroupElement( new StorageProviderStubAttribute(), DatabaseTest.c_unitTestStorageProviderStubID)); _storageConfiguration.StorageGroups.Add( new StorageGroupElement( new TableInheritanceTestDomainAttribute(), TableInheritanceMappingTest.TableInheritanceTestDomainProviderID)); _mappingLoaderConfiguration = new MappingLoaderConfiguration(); _queryConfiguration = new QueryConfiguration("QueriesForStandardMapping.xml"); var typeDiscoveryService = GetTypeDiscoveryService(GetType().Assembly); _mappingConfiguration = new MappingConfiguration( MappingReflectorObjectMother.CreateMappingReflector(typeDiscoveryService), new PersistenceModelLoader(new StorageGroupBasedStorageProviderDefinitionFinder(_storageConfiguration))); }
internal static AppConfig CreateAppConfig( string invariantName = null, string typeName = null, string sqlGeneratorName = null, string spatialProviderType = null) { var mockEFSection = new Mock <EntityFrameworkSection>(); mockEFSection.Setup(m => m.DefaultConnectionFactory).Returns(new DefaultConnectionFactoryElement()); mockEFSection.Setup(m => m.SpatialProviderTypeName).Returns(spatialProviderType); var providers = new ProviderCollection(); if (!string.IsNullOrEmpty(invariantName)) { var providerElement = providers.AddProvider(invariantName, typeName); if (sqlGeneratorName != null) { providerElement.SqlGeneratorElement = new MigrationSqlGeneratorElement { SqlGeneratorTypeName = sqlGeneratorName }; } } mockEFSection.Setup(m => m.Providers).Returns(providers); return(new AppConfig(new ConnectionStringSettingsCollection(), null, mockEFSection.Object)); }
public static void Initialize() { ProviderCollection <StorageProviderDefinition> providers = new ProviderCollection <StorageProviderDefinition>(); providers.Add(new RdbmsProviderDefinition("PerformanceTestDomain", new SqlStorageObjectFactory(), ConnectionString)); StorageConfiguration storageConfiguration = new StorageConfiguration(providers, providers["PerformanceTestDomain"]); DomainObjectsConfiguration.SetCurrent(new FakeDomainObjectsConfiguration(storage: storageConfiguration)); var rootAssemblyFinder = new FixedRootAssemblyFinder(new RootAssembly(typeof(StandardConfiguration).Assembly, true)); var assemblyLoader = new FilteringAssemblyLoader(ApplicationAssemblyLoaderFilter.Instance); var assemblyFinder = new CachingAssemblyFinderDecorator(new AssemblyFinder(rootAssemblyFinder, assemblyLoader)); ITypeDiscoveryService typeDiscoveryService = new AssemblyFinderTypeDiscoveryService(assemblyFinder); MappingConfiguration mappingConfiguration = new MappingConfiguration( new MappingReflector( typeDiscoveryService, new ClassIDProvider(), new ReflectionBasedMemberInformationNameResolver(), new PropertyMetadataReflector(), new DomainModelConstraintProvider(), MappingReflector.CreateDomainObjectCreator()), new PersistenceModelLoader(new StorageGroupBasedStorageProviderDefinitionFinder(DomainObjectsConfiguration.Current.Storage))); MappingConfiguration.SetCurrent(mappingConfiguration); }
public ProviderCollection FetchAll() { ProviderCollection coll = new ProviderCollection(); Query qry = new Query(Provider.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return coll; }
public static ProviderCollection <StorageProviderDefinition> CreateTestDomainStorageProviders() { ProviderCollection <StorageProviderDefinition> storageProviderDefinitionCollection = new ProviderCollection <StorageProviderDefinition>(); var sqlStorageObjectFactory = new SqlStorageObjectFactory(); storageProviderDefinitionCollection.Add( new RdbmsProviderDefinition( DatabaseTest.c_testDomainProviderID, sqlStorageObjectFactory, DatabaseTest.TestDomainConnectionString)); storageProviderDefinitionCollection.Add( new RdbmsProviderDefinition( DatabaseTest.DefaultStorageProviderID, sqlStorageObjectFactory, DatabaseTest.TestDomainConnectionString)); storageProviderDefinitionCollection.Add( new UnitTestStorageProviderStubDefinition( DatabaseTest.c_unitTestStorageProviderStubID)); storageProviderDefinitionCollection.Add( new RdbmsProviderDefinition( TableInheritanceMappingTest.TableInheritanceTestDomainProviderID, sqlStorageObjectFactory, DatabaseTest.TestDomainConnectionString)); return(storageProviderDefinitionCollection); }
protected TestMappingConfiguration() { ProviderCollection <StorageProviderDefinition> storageProviderDefinitionCollection = StorageProviderDefinitionObjectMother.CreateTestDomainStorageProviders(); _storageConfiguration = new StorageConfiguration( storageProviderDefinitionCollection, storageProviderDefinitionCollection[MappingReflectionTestBase.DefaultStorageProviderID]); _storageConfiguration.StorageGroups.Add(new StorageGroupElement(new TestDomainAttribute(), MappingReflectionTestBase.c_testDomainProviderID)); _storageConfiguration.StorageGroups.Add( new StorageGroupElement(new StorageProviderStubAttribute(), MappingReflectionTestBase.c_unitTestStorageProviderStubID)); _storageConfiguration.StorageGroups.Add( new StorageGroupElement(new TableInheritanceTestDomainAttribute(), TableInheritanceMappingTest.TableInheritanceTestDomainProviderID)); _mappingLoaderConfiguration = new MappingLoaderConfiguration(); _queryConfiguration = new QueryConfiguration("QueriesForStandardMapping.xml"); DomainObjectsConfiguration.SetCurrent( new FakeDomainObjectsConfiguration(_mappingLoaderConfiguration, _storageConfiguration, _queryConfiguration)); var typeDiscoveryService = GetTypeDiscoveryService(); _mappingConfiguration = new MappingConfiguration( MappingReflectorObjectMother.CreateMappingReflector(typeDiscoveryService), new PersistenceModelLoader(new StorageGroupBasedStorageProviderDefinitionFinder(DomainObjectsConfiguration.Current.Storage))); MappingConfiguration.SetCurrent(_mappingConfiguration); _domainObjectIDs = new DomainObjectIDs(); }
public async Task RegisterEmptyException() { ProviderCollection providerCollection = (await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false)).GetProviders(); Response <Provider> response = await providerCollection.GetAsync("microsoft.insights"); Assert.ThrowsAsync <RequestFailedException>(async() => { await response.Value.RegisterAsync(""); }); }
public async Task UnregisterNullException() { ProviderCollection providerCollection = (await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false)).GetProviders(); Response <Provider> response = await providerCollection.GetAsync("microsoft.insights"); Assert.ThrowsAsync <ArgumentNullException>(async() => { await response.Value.UnregisterAsync(null); }); }
protected override void OnStart(string[] args) { var tasks = new ProviderCollection <WorkerRoleTask>(typeof(WorkerRole)); workerRole_ = new WorkerRole(tasks); workerRole_.OnStart(); }
/// <summary> /// Fetches the type of the by provider. /// </summary> /// <param name="providerType">Type of the provider.</param> /// <returns></returns> public ProviderCollection FetchByProviderType(ProviderType providerType) { ProviderCollection providerCollection = new ProviderCollection(). Where(Provider.Columns.ProviderTypeId, providerType).OrderByAsc(NAME).Load(); return(providerCollection); }
public void SetUp() { try { var providers = new ProviderCollection <StorageProviderDefinition>(); providers.Add(new RdbmsProviderDefinition("TheStorageProvider", new SqlStorageObjectFactory(), TestDomainConnectionString)); var storageConfiguration = new StorageConfiguration(providers, providers["TheStorageProvider"]); DomainObjectsConfiguration.SetCurrent(new FakeDomainObjectsConfiguration(storage: storageConfiguration)); SqlConnection.ClearAllPools(); var scriptGenerator = new ScriptGenerator( pd => pd.Factory.CreateSchemaScriptBuilder(pd), new RdbmsStorageEntityDefinitionProvider(), new ScriptToStringConverter()); var scripts = scriptGenerator.GetScripts(MappingConfiguration.Current.GetTypeDefinitions()).Single(); var masterAgent = new DatabaseAgent(MasterConnectionString); masterAgent.ExecuteBatchFile("Database\\CreateDB.sql", false, DatabaseConfiguration.GetReplacementDictionary()); var databaseAgent = new DatabaseAgent(TestDomainConnectionString); databaseAgent.ExecuteBatchString(scripts.SetUpScript, true); } catch (Exception e) { Console.WriteLine("SetUpFixture failed: " + e); Console.WriteLine(); throw; } }
public new void InstantiateProviders( ProviderSettingsCollection providerSettingsCollection, ProviderCollection providerCollection, Type providerType, params Type[] providerInterfaces) { base.InstantiateProviders(providerSettingsCollection, providerCollection, providerType, providerInterfaces); }
/// <summary> /// Instantiates the providers. /// </summary> /// <param name="configProviders"> /// The config providers. /// </param> /// <param name="providers"> /// The providers. /// </param> /// <param name="provType"> /// Type of the prov. /// </param> /// <remarks> /// </remarks> public static void InstantiateProviders( ProviderCollection configProviders, ref ProviderCollection providers, Type provType) { foreach (ProviderSettings providerSettings in configProviders) { providers.Add(InstantiateProvider(providerSettings, provType)); } }
/// <summary> /// /// </summary> public static void Instantiate( Config.DataAccessSection config, ProviderCollection providers, Type providerType) { foreach (ProviderSettings settings in config.Providers) { providers.Add(Instantiate(config, settings, providerType)); } }
private static void Initialize() { if (_initialized) { return; } lock (_initializeLock) { if (_initialized) { return; } OnInitializing(); var searchElement = AdxstudioCrmConfigurationManager.GetCrmSection().Search; _enabled = searchElement.Enabled; if (_enabled.GetValueOrDefault(false)) { _providers = new ProviderCollection <SearchProvider>(); foreach (ProviderSettings providerSettings in searchElement.Providers) { _providers.Add(InstantiateProvider <SearchProvider>(providerSettings)); } _providers.SetReadOnly(); if (searchElement.DefaultProvider == null) { throw new ProviderException("Specify a default search provider."); } try { _provider = _providers[searchElement.DefaultProvider]; } catch {} if (_provider == null) { var defaultProviderPropertyInformation = searchElement.ElementInformation.Properties["defaultProvider"]; const string message = "Default Search Provider could not be found."; throw defaultProviderPropertyInformation == null ? (Exception) new ProviderException(message) : new ConfigurationErrorsException(message, defaultProviderPropertyInformation.Source, defaultProviderPropertyInformation.LineNumber); } } _initialized = true; } }
public async Task Exists() { ProviderCollection providerCollection = (await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false)).GetProviders(); Assert.IsTrue(await providerCollection.ExistsAsync("microsoft.insights")); var response = await providerCollection.ExistsAsync("DoesNotExist"); Assert.False(response); }
private void ResolveDbType(string fullTypeNameToIDatabaseStrategy) { // ReSharper disable once PossibleInvalidOperationException var firstOrDefault = ProviderCollection.Select(s => (KeyValuePair <DbAccessType, string>?)s) .FirstOrDefault(s => s.Value.Value == fullTypeNameToIDatabaseStrategy); DbAccessType = firstOrDefault == null ? DbAccessType.Unknown : firstOrDefault.Value.Key; }
public CaptchaConfiguration() { DefaultProvider = DefaultSettings.Name; Providers = new ProviderCollection { InstantiateProvider(DefaultSettings) }; }
public async Task Unregister() { ProviderCollection providerCollection = (await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false)).GetProviders(); Response <Provider> response = await providerCollection.GetAsync("microsoft.insights"); var result = response.Value; var unregister = await result.UnregisterAsync(); Assert.IsNotNull(unregister); }
public void Initialize_WithProviderCollectionAndProvider_Expect() { StorageProviderDefinition providerDefinition = new RdbmsProviderDefinition( "ProviderDefinition", _sqlStorageObjectFactory, "ConnectionString"); ProviderCollection <StorageProviderDefinition> providers = new ProviderCollection <StorageProviderDefinition>(); StorageConfiguration configuration = new StorageConfiguration(providers, providerDefinition); configuration.StorageProviderDefinitions.Add(providerDefinition); }
public ContentManager() { Providers = new ProviderCollection(); resourceCache = new Dictionary <string, LinkedList <IResource> >(); Loaders = new List <IResourceLoader>(); Types = ( from assembly in AppDomain.CurrentDomain.GetAssemblies() from type in assembly.GetExportedTypes() where type.GetInterface("IResource") != null select type).ToDictionary(t => t.Name); }
public StorageConfiguration(ProviderCollection <StorageProviderDefinition> providers, StorageProviderDefinition defaultProvider) : this() { ArgumentUtility.CheckNotNull("providers", providers); _defaultStorageProviderDefinitionHelper.Provider = defaultProvider; ProviderCollection <StorageProviderDefinition> providersCopy = CopyProvidersAsReadOnly(providers); _defaultStorageProviderDefinitionHelper.Providers = providersCopy; }
public async Task TryGet() { ProviderCollection providerCollection = (await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false)).GetProviders(); Provider provider = await providerCollection.GetIfExistsAsync("microsoft.insights"); Assert.IsNotNull(provider); var response = await providerCollection.GetIfExistsAsync("DoesNotExist"); Assert.IsNull(response.Value); }
private ProviderCollection <StorageProviderDefinition> CopyProvidersAsReadOnly(ProviderCollection <StorageProviderDefinition> providers) { ProviderCollection <StorageProviderDefinition> providersCopy = new ProviderCollection <StorageProviderDefinition>(); foreach (StorageProviderDefinition provider in providers) { providersCopy.Add(provider); } providersCopy.SetReadOnly(); return(providersCopy); }
public void Add_providerbase() { ProviderCollection col = new ProviderCollection(); TestProviderBase provider; provider = new TestProviderBase(); provider.Initialize("test", null); col.Add(provider); Assert.AreEqual(provider, col["test"], "A1"); }
public void Add_duplicate() { ProviderCollection col = new ProviderCollection(); TestProvider provider; provider = new TestProvider(); provider.Initialize("test", null); col.Add(provider); col.Add(provider); }
public SchemaGenerationConfiguration() { var sqlStorageObjectFactory = new SqlStorageObjectFactory(); var storageProviderDefinitionCollection = new ProviderCollection <StorageProviderDefinition> { new RdbmsProviderDefinition( DatabaseTest.SchemaGenerationFirstStorageProviderID, sqlStorageObjectFactory, DatabaseTest.SchemaGenerationConnectionString1), new RdbmsProviderDefinition( DatabaseTest.SchemaGenerationSecondStorageProviderID, sqlStorageObjectFactory, DatabaseTest.SchemaGenerationConnectionString2), new RdbmsProviderDefinition( DatabaseTest.SchemaGenerationThirdStorageProviderID, sqlStorageObjectFactory, DatabaseTest.SchemaGenerationConnectionString3), new RdbmsProviderDefinition( DatabaseTest.SchemaGenerationInternalStorageProviderID, sqlStorageObjectFactory, DatabaseTest.SchemaGenerationConnectionString1) }; _storageConfiguration = new StorageConfiguration( storageProviderDefinitionCollection, storageProviderDefinitionCollection[DatabaseTest.SchemaGenerationFirstStorageProviderID]); _storageConfiguration.StorageGroups.Add( new StorageGroupElement( new FirstStorageGroupAttribute(), DatabaseTest.SchemaGenerationFirstStorageProviderID)); _storageConfiguration.StorageGroups.Add( new StorageGroupElement( new SecondStorageGroupAttribute(), DatabaseTest.SchemaGenerationSecondStorageProviderID)); _storageConfiguration.StorageGroups.Add( new StorageGroupElement( new ThirdStorageGroupAttribute(), DatabaseTest.SchemaGenerationThirdStorageProviderID)); _storageConfiguration.StorageGroups.Add( new StorageGroupElement( new InternalStorageGroupAttribute(), DatabaseTest.SchemaGenerationInternalStorageProviderID)); _mappingLoaderConfiguration = new MappingLoaderConfiguration(); _queryConfiguration = new QueryConfiguration(); var typeDiscoveryService = GetTypeDiscoveryService(GetType().Assembly); _mappingConfiguration = new MappingConfiguration( MappingReflectorObjectMother.CreateMappingReflector(typeDiscoveryService), new PersistenceModelLoader(new StorageGroupBasedStorageProviderDefinitionFinder(_storageConfiguration))); _domainObjectsConfiguration = new FakeDomainObjectsConfiguration(_mappingLoaderConfiguration, _storageConfiguration, _queryConfiguration); }
public async Task Get() { ProviderCollection providerCollection = (await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false)).GetProviders(); Response <Provider> response = await providerCollection.GetAsync("microsoft.insights"); Provider result = response.Value; Assert.IsNotNull(result); var ex = Assert.ThrowsAsync <RequestFailedException>(async() => await Client.GetProvider(result.Data.Id + "x").GetAsync()); Assert.AreEqual(404, ex.Status); }
public void Get_nonexistant() { ProviderCollection col = new ProviderCollection(); TestProvider provider; provider = new TestProvider(); provider.Initialize("test", null); col.Add(provider); Assert.AreEqual(provider, col["test"], "A1"); Assert.IsNull(col["test2"], "A2"); }
//methods private static void Initialize() { if (_initialized) { if (_initializeException != null) { throw _initializeException; } } else { if (_initializeException != null) { throw _initializeException; } lock (_lock) { if (_initialized) { if (_initializeException != null) { throw _initializeException; } } else { try { DataModelSection section = ConfigurationManager.GetSection(SectionName) as DataModelSection; _providers = new ProviderCollection(); //fill providers collection foreach (ProviderSettings settings in section.Providers) { _providers.Add(InstantiateProvider(settings, typeof(MetadataProvider))); } _provider = (MetadataProvider)_providers[section.DefaultProvider]; _typeMappings = section.TypeMappings; } catch (Exception exception) { _initializeException = exception; throw; } _initialized = true; } } } }
private static Mock <EntityFrameworkSection> CreateMockSectionWithProviders() { var providers = new ProviderCollection(); providers.AddProvider("Around.The.World", "Around.The.World.Type"); providers.AddProvider("One.More.Time", "One.More.Time.Type"); providers.AddProvider("Robot.Rock", "Robot.Rock.Type"); var mockSection = new Mock <EntityFrameworkSection>(); mockSection.Setup(m => m.Providers).Returns(providers); mockSection.Setup(m => m.DefaultConnectionFactory).Returns(new DefaultConnectionFactoryElement()); return(mockSection); }
private void Initialize() { try { m_providerCollection = new ProviderCollection(); ProviderConfigurationSection qc = null; bool defaultMode = false; //Get the feature's configuration info qc = (ProviderConfigurationSection)ConfigurationManager.GetSection("UserManagerProvider"); if (qc == null) { defaultMode = true; } if (defaultMode) { if (SystemConfiguration.ApplicationName == "Example") { m_defaultProvider = new MockProvider(); } else { m_defaultProvider = new AspNetProvider(); } m_providerCollection.Add(m_defaultProvider); } else { if (qc.DefaultProvider == null || qc.Providers == null || qc.Providers.Count < 1) { throw new System.Configuration.Provider.ProviderException("You must specify a valid default provider."); } //Instantiate the providers ProvidersHelper.InstantiateProviders(qc.Providers, m_providerCollection, typeof(ProviderBase)); m_defaultProvider = m_providerCollection[qc.DefaultProvider]; if (m_defaultProvider == null) { throw new ConfigurationErrorsException("You must specify a default provider for the feature.", qc.ElementInformation.Properties["defaultProvider"].Source, qc.ElementInformation.Properties["defaultProvider"].LineNumber); } } } catch (Exception ex) { //initializationException = ex; isInitialized = false; throw ex; } isInitialized = true; //error-free initialization }
protected override void OnStart(string[] args) { var tasks = new ProviderCollection<WorkerRoleTask>(typeof(WorkerRole)); workerRole_ = new WorkerRole(tasks); workerRole_.OnStart(); }
/// <summary> /// The primary constructor taking in the tasks to be run in this role. /// </summary> /// <param name="tasks"></param> public WorkerRole(ProviderCollection<WorkerRoleTask> tasks) : this() { _tasks = tasks; }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { try { if (this.ProviderType == ProviderType.PaymentProvider) { PaymentServiceSettings paymentServiceSettings = PaymentService.FetchConfiguredPaymentProviders(); if (paymentServiceSettings == null && providerId == 0) {//they haven't selected a provider yet. Response.Redirect("~/admin/paymentselection.aspx", true); } } providerCollection = new ProviderController().FetchByProviderType(ProviderType); if (!Page.IsPostBack) { SetProviderConfiguration(); } SetConfigurationControl(); SetProviderConfigurationProperties(); } catch(Exception ex) { Logger.Error(typeof(providerconfiguration).Name + ".Page_Load", ex); MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message); } }
public ProviderCollection FetchByQuery(Query qry) { ProviderCollection coll = new ProviderCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return coll; }
public ProviderCollection FetchByID(object ProviderId) { ProviderCollection coll = new ProviderCollection().Where("ProviderId", ProviderId).Load(); return coll; }
/// <summary> /// Fetches the type of the by provider. /// </summary> /// <param name="providerType">Type of the provider.</param> /// <returns></returns> public ProviderCollection FetchByProviderType(ProviderType providerType) { ProviderCollection providerCollection = new ProviderCollection(). Where(Provider.Columns.ProviderTypeId, providerType).OrderByAsc(NAME).Load(); return providerCollection; }
protected StorageConfiguration GetPersistenceConfiguration() { StorageConfiguration storageConfiguration = DomainObjectsConfiguration.Current.Storage; if (storageConfiguration.DefaultStorageProviderDefinition == null) { ProviderCollection<StorageProviderDefinition> storageProviderDefinitionCollection = new ProviderCollection<StorageProviderDefinition> (); RdbmsProviderDefinition providerDefinition = new RdbmsProviderDefinition ("Default", new SqlStorageObjectFactory (), "Initial Catalog=DatabaseName;"); storageProviderDefinitionCollection.Add (providerDefinition); storageConfiguration = new StorageConfiguration (storageProviderDefinitionCollection, providerDefinition); } return storageConfiguration; }