This question is locked. New answers and comments are not allowed.
Hi.
I've been trying to make openaccess create sqlite in-memory database for easy testing. However, it appears to be more complicated than i thought.
I'm using forward mapping strategy.
Classes used and code sample:
The result is getting an sqlite exception: ordr table not found. It appears, that created database "forgets" its schema. So I tried adding this piece of code to AdjustForDynamicLoad:
but it didn't help. Can anyone tell my what am I doing wrog or at least if making in-memory db is possible?
Thanks for any advice.
I've been trying to make openaccess create sqlite in-memory database for easy testing. However, it appears to be more complicated than i thought.
I'm using forward mapping strategy.
Classes used and code sample:
[Telerik.OpenAccess.Persistent()]
public class Order
{
public string customer;
public DateTime orderDate;
public string shipAddress;
public IList<
OrderDetail
> details = new List<
OrderDetail
>();
}
[Telerik.OpenAccess.Persistent()]
public class OrderDetail
{
public string product;
public float price;
public int quantity;
public Order order;
}
ObjectScopeProvider1.AdjustForDynamicLoad();
IObjectScope scope = ObjectScopeProvider1.GetNewObjectScope();
scope.Transaction.Begin();
var order = new Order();
order.customer = "aaa";
order.orderDate = DateTime.Now;
order.shipAddress = "bbb";
var detail = new OrderDetail();
detail.price = 423;
detail.product = "ccc";
detail.quantity = 3;
var detail2 = new OrderDetail();
detail2.price = 42334;
detail2.product = "ddd";
detail2.quantity = 33;
order.details.Add(detail);
order.details.Add(detail2);
scope.Add(order);
scope.Transaction.Commit();
<
connection
id
=
"db_connection"
>
<
databasename
>:memory:</
databasename
>
<
servername
>lt</
servername
>
<
integratedSecurity
>True</
integratedSecurity
>
<
backendconfigurationname
>sqliteConfiguration</
backendconfigurationname
>
</
connection
>
The result is getting an sqlite exception: ordr table not found. It appears, that created database "forgets" its schema. So I tried adding this piece of code to AdjustForDynamicLoad:
ISchemaHandler schemaHandler = db.GetSchemaHandler();
schemaHandler.CreateDatabase();
string script = schemaHandler.CreateDDLScript();
schemaHandler.ExecuteDDLScript(script);
but it didn't help. Can anyone tell my what am I doing wrog or at least if making in-memory db is possible?
Thanks for any advice.