How to use RelationalStructureDiscoveryFactory class of NBi.Core.Structure.Relational package

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

RelationalStructureDiscoveryFactoryTest.cs

Source:RelationalStructureDiscoveryFactoryTest.cs Github

copy

Full Screen

...16 [Test]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 }181 ...

Full Screen

Full Screen

StructureDiscoveryFactoryProvider.cs

Source:StructureDiscoveryFactoryProvider.cs Github

copy

Full Screen

...33 34 protected virtual void Initialize()35 {36 dico.Add(Olap, typeof(OlapStructureDiscoveryFactory));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)}); ...

Full Screen

Full Screen

RelationalStructureDiscoveryFactory.cs

Source:RelationalStructureDiscoveryFactory.cs Github

copy

Full Screen

...8using System.Threading.Tasks;910namespace NBi.Core.Structure.Relational11{12 class RelationalStructureDiscoveryFactory : IStructureDiscoveryFactory13 {14 private readonly IDbConnection connection;15 public RelationalStructureDiscoveryFactory(IDbConnection connection)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:53 throw new ArgumentOutOfRangeException(string.Format("The value '{0}' is not supported when instantiating with 'RelationalStructureDiscoveryFactory'.", target));54 }55 }5657 }58} ...

Full Screen

Full Screen

RelationalStructureDiscoveryFactory

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;7using NBi.Core.Structure;8{9 {10 static void Main(string[] args)11 {12 var connectionString = "Server=.;Database=AdventureWorks2012;Trusted_Connection=true";13 var factory = new RelationalStructureDiscoveryFactory();14 var discoveryCommand = factory.Instantiate(new StructureDiscoveryRequest(DiscoveryTarget.Table, connectionString));15 var structure = discoveryCommand.Execute();16 Console.WriteLine(structure);17 Console.ReadKey();18 }19 }20}21using System;22using System.Collections.Generic;23using System.Linq;24using System.Text;25using System.Threading.Tasks;26using NBi.Core.Structure.Relational;27using NBi.Core.Structure;28{29 {30 static void Main(string[] args)31 {32 var connectionString = "Server=.;Database=AdventureWorks2012;Trusted_Connection=true";33 var factory = new RelationalStructureDiscoveryFactory();34 var discoveryCommand = factory.Instantiate(new StructureDiscoveryRequest(DiscoveryTarget.Table, connectionString));35 var structure = discoveryCommand.Execute();36 Console.WriteLine(structure);37 Console.ReadKey();38 }39 }40}41using System;42using System.Collections.Generic;43using System.Linq;44using System.Text;45using System.Threading.Tasks;46using NBi.Core.Structure.Relational;47using NBi.Core.Structure;48{49 {50 static void Main(string[] args)51 {52 var connectionString = "Server=.;Database=AdventureWorks2012;Trusted_Connection=true";53 var factory = new RelationalStructureDiscoveryFactory();54 var discoveryCommand = factory.Instantiate(new StructureDiscoveryRequest(DiscoveryTarget.Table, connectionString));55 var structure = discoveryCommand.Execute();56 Console.WriteLine(structure);57 Console.ReadKey();58 }59 }60}61using System;62using System.Collections.Generic;63using System.Linq;64using System.Text;65using System.Threading.Tasks;

Full Screen

Full Screen

RelationalStructureDiscoveryFactory

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 command = factory.Instantiate(new NBi.Core.Structure.Relational.RelationalDiscoveryRequest()13 {14 ConnectionString = "Data Source=.;Initial Catalog=AdventureWorks2014;Integrated Security=True",15 });16 var result = command.Execute();17 foreach (var row in result)18 {19 foreach (var cell in row)20 {21 Console.Write(cell);22 Console.Write("\t");23 }24 Console.WriteLine();25 }26 Console.ReadLine();27 }28 }29}

Full Screen

Full Screen

RelationalStructureDiscoveryFactory

Using AI Code Generation

copy

Full Screen

1using NBi.Core.Structure.Relational;2using NBi.Core.Structure.Relational.Factory;3using System;4using System.Collections.Generic;5using System.Linq;6using System.Text;7using System.Threading.Tasks;8{9 {10 static void Main(string[] args)11 {12 var factory = new RelationalStructureDiscoveryFactory();13 var args = new RelationalStructureDiscoveryArgs("Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True");14 args.DbType = NBi.Core.Query.ClientType.SqlClient;15 var command = new RelationalStructureDiscoveryCommand(factory, args);16 var result = command.Execute();17 Console.WriteLine(result);18 }19 }20}21using NBi.Core.Structure.Relational;22using NBi.Core.Structure.Relational.Factory;23using System;24using System.Collections.Generic;25using System.Linq;26using System.Text;27using System.Threading.Tasks;28{29 {30 static void Main(string[] args)31 {32 var factory = new RelationalStructureDiscoveryFactory();33 var args = new RelationalStructureDiscoveryArgs("Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True");34 args.DbType = NBi.Core.Query.ClientType.SqlClient;35 args.TableName = "Person.Address";36 var command = new RelationalStructureDiscoveryCommand(factory, args);37 var result = command.Execute();38 Console.WriteLine(result);39 }40 }41}

Full Screen

Full Screen

RelationalStructureDiscoveryFactory

Using AI Code Generation

copy

Full Screen

1using NBi.Core.Structure.Relational;2using NBi.Core.Structure;3using System;4{5 {6 static void Main(string[] args)7 {8 var factory = new RelationalStructureDiscoveryFactory();9 var command = factory.Instantiate("select * from dbo.table1");10 var result = command.Execute();11 var structure = result.Structure;12 var columns = structure.Columns;13 foreach (var column in columns)14 {15 Console.WriteLine(column.Name);16 }17 }18 }19}20using NBi.Core.Structure.Relational;21using NBi.Core.Structure;22using System;23{24 {25 static void Main(string[] args)26 {27 var factory = new RelationalDiscoveryCommandFactory();28 var command = factory.Instantiate("select * from dbo.table1");29 var result = command.Execute();30 var structure = result.Structure;31 var columns = structure.Columns;32 foreach (var column in columns)33 {34 Console.WriteLine(column.Name);35 }36 }37 }38}39using NBi.Core.Structure.Relational;40using NBi.Core.Structure;41using System;42{43 {44 static void Main(string[] args)45 {46 var factory = new RelationalDiscoveryRequestFactory();47 var command = factory.Instantiate("select * from dbo.table1");48 var result = command.Execute();49 var structure = result.Structure;50 var columns = structure.Columns;51 foreach (var column in columns)52 {53 Console.WriteLine(column.Name);54 }55 }56 }57}58using NBi.Core.Structure.Relational;59using NBi.Core.Structure;60using System;61{62 {63 static void Main(string[] args)64 {65 var factory = new RelationalDiscoveryCommandFactory();66 var command = factory.Instantiate("select * from dbo.table1");67 var result = command.Execute();68 var structure = result.Structure;69 var columns = structure.Columns;70 foreach (

Full Screen

Full Screen

RelationalStructureDiscoveryFactory

Using AI Code Generation

copy

Full Screen

1using NBi.Core.Structure.Relational;2using NBi.Core.Structure;3using NBi.Core;4using NBi.Core.ResultSet;5using NBi.Core.ResultSet.Comparer;6using NBi.Core.ResultSet.Equivalence;7using NBi.Core.ResultSet.Lookup;8using NBi.Core.Calculation;9using System.Data;10using System.Collections.Generic;11using System;12using System.Linq;13using System.IO;14using System.Text;15using System.Threading.Tasks;16using System.Data.SqlClient;17using System.Collections;18using System.Collections.Specialized;19{20 {21 public static void Main(string[] args)22 {23 var connectionString = @"Data Source=.\SQL2014;Initial Catalog=AdventureWorks2014;Integrated Security=True";24 var factory = new RelationalStructureDiscoveryFactory();25 var cmd = new RelationalStructureDiscoveryCommand();26 cmd.ConnectionString = connectionString;27 cmd.DiscoveryType = DiscoveryTarget.Table;28 var request = new RelationalStructureDiscoveryRequest(cmd);29 var engine = new RelationalStructureDiscoveryEngine();30 var result = new RelationalStructureDiscoveryResult();31 result = engine.Execute(request);32 Console.WriteLine(result.ToString());33 }34 }35}36using NBi.Core.Structure.Relational;37using NBi.Core.Structure;38using NBi.Core;39using NBi.Core.ResultSet;40using NBi.Core.ResultSet.Comparer;41using NBi.Core.ResultSet.Equivalence;42using NBi.Core.ResultSet.Lookup;43using NBi.Core.Calculation;44using System.Data;45using System.Collections.Generic;46using System;47using System.Linq;48using System.IO;49using System.Text;50using System.Threading.Tasks;51using System.Data.SqlClient;52using System.Collections;53using System.Collections.Specialized;54{

Full Screen

Full Screen

RelationalStructureDiscoveryFactory

Using AI Code Generation

copy

Full Screen

1using NBi.Core.Structure.Relational;2RelationalStructureDiscoveryFactory factory = new RelationalStructureDiscoveryFactory();3RelationalStructureDiscoveryCommand command = new RelationalStructureDiscoveryCommand();4StructureDiscoveryArgs args = new StructureDiscoveryArgs();5StructureDiscoveryRequest request = new StructureDiscoveryRequest();6StructureDiscoveryResult result = new StructureDiscoveryResult();7StructureDiscoveryException exception = new StructureDiscoveryException();8RelationalStructureDiscoveryFactory factory = new RelationalStructureDiscoveryFactory();9RelationalStructureDiscoveryCommand command = new RelationalStructureDiscoveryCommand();10StructureDiscoveryArgs args = new StructureDiscoveryArgs();11StructureDiscoveryRequest request = new StructureDiscoveryRequest();12StructureDiscoveryResult result = new StructureDiscoveryResult();13StructureDiscoveryException exception = new StructureDiscoveryException();14RelationalStructureDiscoveryFactory factory = new RelationalStructureDiscoveryFactory();15RelationalStructureDiscoveryCommand command = new RelationalStructureDiscoveryCommand();16StructureDiscoveryArgs args = new StructureDiscoveryArgs();17StructureDiscoveryRequest request = new StructureDiscoveryRequest();18StructureDiscoveryResult result = new StructureDiscoveryResult();19StructureDiscoveryException exception = new StructureDiscoveryException();20RelationalStructureDiscoveryFactory factory = new RelationalStructureDiscoveryFactory();

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 methods 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