This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void TestCreate() | |
{ | |
private IDatabaseTypesFactory factory = new DatabaseTypesFactorySqlServer(); | |
// Intialize database connection string | |
factory.ConnectionString = "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=D:\\Dev\\FrozenElephant\\SymbioticORM\\SqlDatabase\\SymbioticTestLocal.mdf;Integrated Security=True;Connect Timeout=30"; | |
//Create the object to save | |
ErrorItem er = new ErrorItem(); | |
er.ItemDate = DateTime.Now; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void TestExecuteNonQuery() | |
{ | |
IDatabaseTypesFactory factory = new DatabaseTypesFactorySqlServer(); | |
factory.ConnectionString = "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=D:\\Dev\\FrozenElephant\\SymbioticORM\\SqlDatabase\\SymbioticTestLocal.mdf;Integrated Security=True;Connect Timeout=30"; | |
IObjectWriter writer = factory.CreateObjectWriter(); | |
SqlQuerySimple sql = factory.CreateSqlQuery("update errors set errorinfo= @errorinfo where errorid= @errorid"); | |
sql.CreateAndAddParameter(factory, DbType.String, "errorinfo", "Test: " + DateTime.Now.ToString()); | |
sql.CreateAndAddParameter(factory, DbType.Int32, "errorid", 4); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void TestScalar() | |
{ | |
IDatabaseTypesFactory factory = new DatabaseTypesFactorySqlServer(); | |
factory.ConnectionString = "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=D:\\Dev\\FrozenElephant\\SymbioticORM\\SqlDatabase\\SymbioticTestLocal.mdf;Integrated Security=True;Connect Timeout=30"; | |
IObjectLoader loader = factory.CreateObjectLoader(); | |
decimal val = loader.ExecuteScalar<decimal>(factory.CreateSqlQuery("Select count(*) from people","TestScalar")); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void TestLoadItems() | |
{ | |
IDatabaseTypesFactory factory = new DatabaseTypesFactorySqlServer(); | |
factory.ConnectionString = "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=D:\\Dev\\FrozenElephant\\SymbioticORM\\SqlDatabase\\SymbioticTestLocal.mdf;Integrated Security=True;Connect Timeout=30"; | |
IObjectLoader loader = factory.CreateObjectLoader(); | |
IList<Person> people = loader.ObtainItems<Person>(factory.CreateSqlQuery("Select top 2000 * from People","TestLoadItems")); | |
if (people.Count == 0) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ParallelLoadItems() | |
{ | |
IDatabaseTypesFactory factory = new DatabaseTypesFactorySqlServer(); | |
factory.ConnectionString = "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=D:\\Dev\\FrozenElephant\\SymbioticORM\\SqlDatabase\\SymbioticTestLocal.mdf;Integrated Security=True;Connect Timeout=30"; | |
IObjectLoader loader = factory.CreateObjectLoader(); | |
IList<ISqlQuery> queries = new List<ISqlQuery>(); | |
ISqlQuery s1 = factory.CreateSqlQuery("Select top 2000 * from People","ParallelLoadItems:Person", typeof(Person)); | |
queries.Add(s1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ParallelLoadHierarchyItems() | |
{ | |
IDatabaseTypesFactory factory = new DatabaseTypesFactorySqlServer(); | |
factory.ConnectionString = "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=D:\\Dev\\FrozenElephant\\SymbioticORM\\SqlDatabase\\SymbioticTestLocal.mdf;Integrated Security=True;Connect Timeout=30"; | |
IObjectLoader loader = factory.CreateObjectLoader(); | |
IList<ISqlQuery> queries = new List<ISqlQuery>(); | |
ISqlQuery s1 = factory.CreateSqlQuery("Select top 2000 * from People", "ParallelLoadHierarchyItems1", typeof(Person)); | |
queries.Add(s1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void TestInsertUpdate() | |
{ | |
IDatabaseTypesFactory factory = new DatabaseTypesFactorySqlServer(); | |
// Intialize database connection string | |
factory.ConnectionString = "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=D:\\Dev\\FrozenElephant\\SymbioticORM\\SqlDatabase\\SymbioticTestLocal.mdf;Integrated Security=True;Connect Timeout=30"; | |
IObjectWriter writer = factory.CreateObjectWriter(); | |
//Should do an insert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void TestDelete() | |
{ | |
IDatabaseTypesFactory factory = new DatabaseTypesFactorySqlServer(); | |
// Intialize database connection string | |
factory.ConnectionString = "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=D:\\Dev\\FrozenElephant\\SymbioticORM\\SqlDatabase\\SymbioticTestLocal.mdf;Integrated Security=True;Connect Timeout=30"; | |
IObjectWriter writer = factory.CreateObjectWriter(); | |
ErrorItem er = CreateErrorItem("Test 444 " + DateTime.Now.ToString()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void TestLoadItemById() | |
{ | |
IDatabaseTypesFactory factory = new DatabaseTypesFactorySqlServer(); | |
factory.ConnectionString = "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=D:\\Dev\\FrozenElephant\\SymbioticORM\\SqlDatabase\\SymbioticTestLocal.mdf;Integrated Security=True;Connect Timeout=30"; | |
IObjectLoader loader = factory.CreateObjectLoader(); | |
Person p = loader.ObtainItem<Person>(6000); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports FrozenElephant.Symbiotic | |
<TestClass()> | |
Public Class TestsSimpleCRUD | |
Private m_DBTypesFactory As IDatabaseTypesFactory | |
''' <summary> |
OlderNewer