How to use Instantiate method of NBi.Core.Structure.Relational.RelationalStructureDiscoveryFactory class

Best NBi code snippet using NBi.Core.Structure.Relational.RelationalStructureDiscoveryFactory.Instantiate

RelationalStructureDiscoveryFactoryTest.cs

Source:RelationalStructureDiscoveryFactoryTest.cs Github

copy

Full Screen

...17 public void Execute_Schema_ListStructureContainingManyElements()18 {19 var conn = new SqlConnection(ConnectionStringReader.GetSqlClient());20 var factory = new RelationalStructureDiscoveryFactory(conn);21 var cmd = factory.Instantiate(Target.Perspectives, TargetType.Object,22 new IFilter[] {23 });2425 var structs = cmd.Execute();2627 Assert.That(structs.Count(), Is.EqualTo(18)); //All available schemas28 }2930 [Test]31 public void Execute_SchemaWithDbo_ListStructureContainingManyElements()32 {33 var conn = new SqlConnection(ConnectionStringReader.GetSqlClient());34 var factory = new RelationalStructureDiscoveryFactory(conn);35 var cmd = factory.Instantiate(Target.Perspectives, TargetType.Object,36 new [] {37 new OwnerFilter("dbo")38 });3940 var structs = cmd.Execute();4142 Assert.That(structs.Count(), Is.EqualTo(6)); //Standards 43 }4445 [Test]46 public void Execute_Table_ListStructureContainingFifteenElements()47 {48 var conn = new SqlConnection(ConnectionStringReader.GetSqlClient());49 var factory = new RelationalStructureDiscoveryFactory(conn);50 var cmd = factory.Instantiate(Target.Tables, TargetType.Object,51 new [] { 52 new CaptionFilter(Target.Perspectives, "Sales"),53 });5455 var structs = cmd.Execute();5657 Assert.That(structs.Count(), Is.EqualTo(19 + 7));//Tables + Views58 }5960 [Test]61 public void Execute_Column_ListStructureContainingSevenElements()62 {63 var conn = new SqlConnection(ConnectionStringReader.GetSqlClient());64 var factory = new RelationalStructureDiscoveryFactory(conn);65 var cmd = factory.Instantiate(Target.Columns, TargetType.Object,66 new [] {67 new CaptionFilter(Target.Perspectives,"Sales"),68 new CaptionFilter(Target.Tables,"Customer"),69 });7071 var structs = cmd.Execute();7273 Assert.That(structs.Count(), Is.EqualTo(7));74 }757677 //[Test]78 //public void Execute_DateDimensionLinkedToElevenMeasureGroups_ListStructureContainingTenElements()79 //{80 // var disco = new DiscoveryRequestFactory().BuildRelation(81 // ConnectionStringReader.GetAdomd()82 // , DiscoveryTarget.MeasureGroups83 // , new List<IFilter>() { 84 // new CaptionFilter("Adventure Works", DiscoveryTarget.Perspectives)85 // , new CaptionFilter("Customer", DiscoveryTarget.Dimensions)86 // });8788 // var factory = new AdomdDiscoveryCommandFactory();89 // var cmd = factory.BuildExact(disco);9091 // var structs = cmd.Execute();9293 // Assert.That(structs.Count(), Is.EqualTo(10));94 //}9596 [Test]97 public void Execute_Routines_ListStructureContainingThreeElements()98 {99 var conn = new SqlConnection(ConnectionStringReader.GetSqlClient());100 var factory = new RelationalStructureDiscoveryFactory(conn);101 var cmd = factory.Instantiate(Target.Routines, TargetType.Object,102 new [] {103 new CaptionFilter(Target.Perspectives,"HumanResources")104 });105106 var structs = cmd.Execute();107108 Assert.That(structs.Count(), Is.EqualTo(3));109 }110111 [Test]112 public void Execute_RoutinesWithName_ListStructureContainingThisRoutine()113 {114 var conn = new SqlConnection(ConnectionStringReader.GetSqlClient());115 var factory = new RelationalStructureDiscoveryFactory(conn);116 var cmd = factory.Instantiate(Target.Routines, TargetType.Object,117 new [] {118 new CaptionFilter(Target.Perspectives,"dbo")119 , new CaptionFilter(Target.Routines,"ufnGetContactInformation")120 });121122 var structs = cmd.Execute();123124 Assert.That(structs.Count(), Is.EqualTo(1));125 }126127 [Test]128 public void Execute_Parameters_ListStructureContainingFiveElements()129 {130 var conn = new SqlConnection(ConnectionStringReader.GetSqlClient());131 var factory = new RelationalStructureDiscoveryFactory(conn);132 var cmd = factory.Instantiate(Target.Parameters, TargetType.Object,133 new [] {134 new CaptionFilter(Target.Perspectives,"HumanResources")135 , new CaptionFilter(Target.Routines,"uspUpdateEmployeePersonalInfo")136 });137138 var structs = cmd.Execute();139140 Assert.That(structs.Count(), Is.EqualTo(5));141 }142143 [Test]144 public void Execute_ParameterWithName_ListStructureContainingThisParameter()145 {146 var conn = new SqlConnection(ConnectionStringReader.GetSqlClient());147 var factory = new RelationalStructureDiscoveryFactory(conn);148 var cmd = factory.Instantiate(Target.Parameters, TargetType.Object,149 new [] {150 new CaptionFilter(Target.Perspectives,"HumanResources")151 , new CaptionFilter(Target.Routines,"uspUpdateEmployeePersonalInfo")152 , new CaptionFilter(Target.Parameters,"BirthDate")153 });154155 var structs = cmd.Execute();156157 Assert.That(structs.Count(), Is.EqualTo(1));158 Assert.That(structs.ElementAt(0), Is.EqualTo("BirthDate"));159 }160161 [Test]162 [TestCase(true, 0)]163 [TestCase(false, 1)]164 public void Execute_ParameterWithNameAndResult_ListStructureContainingThisParameter(bool isResult, int count)165 {166 var conn = new SqlConnection(ConnectionStringReader.GetSqlClient());167 var factory = new RelationalStructureDiscoveryFactory(conn);168 var cmd = factory.Instantiate(Target.Parameters, TargetType.Object,169 new IFilter [] {170 new CaptionFilter(Target.Perspectives,"HumanResources")171 , new CaptionFilter(Target.Routines,"uspUpdateEmployeePersonalInfo")172 , new CaptionFilter(Target.Parameters,"BirthDate")173 , new IsResultFilter(isResult)174 });175176 var structs = cmd.Execute();177178 Assert.That(structs.Count(), Is.EqualTo(count));179 }180 }181182 ...

Full Screen

Full Screen

StructureDiscoveryFactoryProvider.cs

Source:StructureDiscoveryFactoryProvider.cs Github

copy

Full Screen

...37 dico.Add(Relational, typeof(RelationalStructureDiscoveryFactory));38 dico.Add(Tabular, typeof(TabularStructureDiscoveryFactory));39 }4041 public IStructureDiscoveryFactory Instantiate(string connectionString)42 {43 var sessionFactory = new ClientProvider();44 var connection = sessionFactory.Instantiate(connectionString).CreateNew() as IDbConnection;45 var dbType = MapConnectionTypeToDatabaseType(connection);4647 if (!dico.Keys.Contains(dbType))48 throw new ArgumentException();4950 var factoryType = dico[dbType];51 var ctor = factoryType.GetConstructor(new Type[]{typeof(IDbConnection)});52 var factory = (IStructureDiscoveryFactory)ctor.Invoke(new object[] { connection });5354 return factory;55 }5657 protected virtual string MapConnectionTypeToDatabaseType(IDbConnection connection)58 { ...

Full Screen

Full Screen

RelationalStructureDiscoveryFactory.cs

Source:RelationalStructureDiscoveryFactory.cs Github

copy

Full Screen

...16 {17 this.connection = connection as IDbConnection;18 }1920 public StructureDiscoveryCommand Instantiate(Target target, TargetType type, IEnumerable<IFilter> filters)21 {22 var builder = InstantiateBuilder(target);23 builder.Build(filters);2425 var cmd = connection.CreateCommand();26 cmd.CommandText = builder.GetCommandText();27 var postFilters = builder.GetPostFilters();2829 var description = new CommandDescription(target, filters);3031 RelationalCommand command = null;32 command = new RelationalCommand(cmd, postFilters, description);3334 return command;35 }363738 protected virtual IDiscoveryCommandBuilder InstantiateBuilder(Target target)39 {40 switch (target)41 {42 case Target.Perspectives:43 return new SchemaDiscoveryCommandBuilder();44 case Target.Tables:45 return new TableDiscoveryCommandBuilder();46 case Target.Columns:47 return new ColumnDiscoveryCommandBuilder();48 case Target.Routines:49 return new RoutineDiscoveryCommandBuilder();50 case Target.Parameters:51 return new RoutineParameterDiscoveryCommandBuilder();52 default: ...

Full Screen

Full Screen

Instantiate

Using AI Code Generation

copy

Full Screen

1NBi.Core.Structure.Relational.RelationalStructureDiscoveryFactory factory = new NBi.Core.Structure.Relational.RelationalStructureDiscoveryFactory();2NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand command = new NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand();3command.ConnectionString = "Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=SSPI;";4command.SchemaName = "HumanResources";5command.TableName = "Shift";6factory.Instantiate(command);7NBi.Core.Structure.Relational.RelationalStructureDiscoveryFactory factory = new NBi.Core.Structure.Relational.RelationalStructureDiscoveryFactory();8NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand command = new NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand();9command.ConnectionString = "Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=SSPI;";10command.SchemaName = "HumanResources";11command.TableName = "Shift";12factory.Instantiate(command);13NBi.Core.Structure.Relational.RelationalStructureDiscoveryFactory factory = new NBi.Core.Structure.Relational.RelationalStructureDiscoveryFactory();14NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand command = new NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand();15command.ConnectionString = "Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=SSPI;";16command.SchemaName = "HumanResources";17command.TableName = "Shift";18factory.Instantiate(command);19NBi.Core.Structure.Relational.RelationalStructureDiscoveryFactory factory = new NBi.Core.Structure.Relational.RelationalStructureDiscoveryFactory();20NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand command = new NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand();21command.ConnectionString = "Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=SSPI;";22command.SchemaName = "HumanResources";23command.TableName = "Shift";24factory.Instantiate(command);

Full Screen

Full Screen

Instantiate

Using AI Code Generation

copy

Full Screen

1NBi.Core.Structure.Relational.RelationalStructureDiscoveryFactory factory = new NBi.Core.Structure.Relational.RelationalStructureDiscoveryFactory();2NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand cmd = factory.Instantiate("Table");3cmd.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorksDW2012;Integrated Security=True";4cmd.Table = "DimProduct";5NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand cmd = factory.Instantiate("Table");6cmd.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorksDW2012;Integrated Security=True";7cmd.Table = "DimProduct";8NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand cmd = factory.Instantiate("Table");9cmd.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorksDW2012;Integrated Security=True";10cmd.Table = "DimProduct";11NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand cmd = factory.Instantiate("Table");12cmd.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorksDW2012;Integrated Security=True";13cmd.Table = "DimProduct";14NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand cmd = factory.Instantiate("Table");15cmd.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorksDW2012;Integrated Security=True";16cmd.Table = "DimProduct";17NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand cmd = factory.Instantiate("Table");18cmd.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorksDW2012;Integrated Security=True";19cmd.Table = "DimProduct";20NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand cmd = factory.Instantiate("Table");21cmd.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorksDW2012;Integrated Security=True";22cmd.Table = "DimProduct";23NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand cmd = factory.Instantiate("Table");24cmd.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorksDW2012;Integrated Security=True";25cmd.Table = "DimProduct";26NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand cmd = factory.Instantiate("Table");27cmd.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorksDW2012;Integrated Security=True";28cmd.Table = "DimProduct";29NBi.Core.Structure.Relational.RelationalStructureDiscoveryCommand cmd = factory.Instantiate("Table");30cmd.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorksDW2012;Integrated

Full Screen

Full Screen

Instantiate

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using System.Data;7using NBi.Core.Structure;8using NBi.Core.Structure.Relational;9{10 {11 public RelationalStructureDiscoveryFactory()12 {13 }14 public void Instantiate()15 {16 string connectionString = "Data Source=(local);Initial Catalog=AdventureWorks;Integrated Security=True";17 RelationalStructureDiscoveryFactory factory = new RelationalStructureDiscoveryFactory();18 IStructureDiscoveryCommand command = factory.Instantiate(RelationalStructureDiscoveryRequestFactory.New()19 .Build()20 .ForColumns()21 .ForTable("HumanResources.Department")22 .ForDatabase(connectionString));23 }24 }25}

Full Screen

Full Screen

Instantiate

Using AI Code Generation

copy

Full Screen

1using System;2using System.Data;3using System.Data.SqlClient;4using System.Collections.Generic;5using NBi.Core.Structure;6using NBi.Core.Structure.Relational;7using NBi.Core.Structure.Relational.Query;8using NBi.Core.Structure.Relational.Query.Command;9using NBi.Core.Structure.Relational.Query.Command;10using NBi.Core.Structure.Relational.Query.Client;

Full Screen

Full Screen

Instantiate

Using AI Code Generation

copy

Full Screen

1using NBi.Core.Structure.Relational;2using NBi.Core.Structure;3using NBi.Core.Structure.Olap;4using NBi.Core.Structure.Relational.Hierarchy;5using System.Data;6using System;7using System.Collections.Generic;8using System.Linq;9using System.Text;10using System.Threading.Tasks;11using NBi.Core.Query;12using NBi.Core.Query.Command;13using NBi.Core.Query.Resolver;14using NBi.Core.Query.Client;15using NBi.Core.Query.Client.SqlClient;16using NBi.Core.Query.Client.Odbc;17using NBi.Core.Query.Client.OleDb;18using NBi.Core.Query.Client.Oracle;19using NBi.Core.Query.Client.MySql;20using NBi.Core.Query.Client.Presto;21using NBi.Core.Query.Client.SqLite;22using NBi.Core.Query.Client.BigQuery;23using NBi.Core.Query.Client.Postgres;24using NBi.Core.Query.Client.SapHana;25using NBi.Core.Query.Client.Redshift;26using NBi.Core.Query.Client.Ado;27using NBi.Core.Query.Client.AdoDotNet;28using NBi.Core.Query.Client.Access;29{30 {31 public void Test()32 {33 RelationalStructureDiscoveryFactory myRelationalStructureDiscoveryFactory = new RelationalStructureDiscoveryFactory();34 RelationalStructureDiscoveryRequest myRelationalStructureDiscoveryRequest = new RelationalStructureDiscoveryRequest();35 myRelationalStructureDiscoveryRequest.ConnectionString = "Data Source=.;Initial Catalog=AdventureWorks;Integrated Security=True";36 myRelationalStructureDiscoveryRequest.CommandText = "SELECT * FROM Sales.SalesOrderDetail";37 myRelationalStructureDiscoveryRequest.CommandType = CommandType.Text;38 myRelationalStructureDiscoveryRequest.QueryTimeout = 30;39 myRelationalStructureDiscoveryRequest.QueryType = QueryType.Text;40 myRelationalStructureDiscoveryRequest.QueryTimeout = 30;

Full Screen

Full Screen

Instantiate

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using NBi.Core.Structure.Relational;7{8 {9 static void Main(string[] args)10 {11 var factory = new RelationalStructureDiscoveryFactory();12 var discovery = factory.Instantiate("SELECT * FROM [dbo].[Table1]");13 var result = discovery.Execute();14 foreach (var row in result.Rows)15 {16 foreach (var column in result.Columns)17 {18 Console.WriteLine(row[column]);19 }20 }21 }22 }23}24using System;25using System.Collections.Generic;26using System.Linq;27using System.Text;28using System.Threading.Tasks;29using NBi.Core.Structure.Olap;30{31 {32 static void Main(string[] args)33 {34 var factory = new OlapStructureDiscoveryFactory();35 var discovery = factory.Instantiate("SELECT [Measures].[Amount] ON COLUMNS, [Product].[Product Category].MEMBERS ON ROWS FROM [Adventure Works]");36 var result = discovery.Execute();37 foreach (var row in result.Rows)38 {39 foreach (var column in result.Columns)40 {41 Console.WriteLine(row[column]);42 }43 }44 }45 }46}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run NBi automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in RelationalStructureDiscoveryFactory

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful