8 Answers, 1 is accepted
0
Hi Erik,
You can use the schema handler to execute all schema related operations:
Regards,
Jan Blessenohl
the Telerik team
You can use the schema handler to execute all schema related operations:
var schema = context.GetSchemaHandler();
var exists = schema.DatabaseExists();
var script =
""
;
if
(exists ==
false
)
{
schema.CreateDatabase();
script = schema.CreateDDLScript();
}
else
{
script = schema.CreateUpdateDDLScript(
new
SchemaUpdateProperties() { CheckExtraColumns =
false
});
}
if
(
string
.IsNullOrEmpty(script) ==
false
)
{
schema.ExecuteDDLScript(script);
}
Regards,
Jan Blessenohl
the Telerik team
OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
0

Erik
Top achievements
Rank 1
answered on 31 Jul 2012, 09:54 PM
Hi Jan,
Thanks for your reply.
Using your code, the SQLite database file is created, however the line
returns an empty string. Am I missing a step?
Additionally, is it possible to specify file name and location for the SQLite database file?
Thanks for your reply.
Using your code, the SQLite database file is created, however the line
script = schema.CreateDDLScript();
Additionally, is it possible to specify file name and location for the SQLite database file?
0
Hi Erik,
Do you have classes in your Domain model? Can you check the 'Update Schema' property for each domain class (press F4 to open the Properties window and check the property value) ? It should be set to 'true'.
In cae this does not work can you send me your .rlinq file so that I can have a deeper look at it?
Regards,
Ady
the Telerik team
Do you have classes in your Domain model? Can you check the 'Update Schema' property for each domain class (press F4 to open the Properties window and check the property value) ? It should be set to 'true'.
In cae this does not work can you send me your .rlinq file so that I can have a deeper look at it?
Regards,
Ady
the Telerik team
OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
0

Erik
Top achievements
Rank 1
answered on 04 Aug 2012, 08:34 AM
Hi Ady,
Setting the update schema property to true fixes the schema creation :)
I want to be able to specify the SQLite file name and location during runtime, do you know if this is possible?
Setting the update schema property to true fixes the schema creation :)
I want to be able to specify the SQLite file name and location during runtime, do you know if this is possible?
0
Hello Erik,
You can specify the fully qualified file name in the 'DataSource' property of the connection string and then use this connection string to construct the context instance. What does your connection string look like now? What is the value specified with the 'DataSource' keyword?
Kind regards,
Ady
the Telerik team
You can specify the fully qualified file name in the 'DataSource' property of the connection string and then use this connection string to construct the context instance. What does your connection string look like now? What is the value specified with the 'DataSource' keyword?
Kind regards,
Ady
the Telerik team
OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
0

Erik
Top achievements
Rank 1
answered on 17 Aug 2012, 06:30 PM
Hi Ady,
The Connection.ConnectionString is:
"data source=C:\Users\xxxx\MyFolder\testdb;failifmissing=True;enlist=False"
Connection.DataSource is:
"testdb"
When I try to modify the Connection.ConnectionString during runtime I get a System.InvalidOperationException:
"Cannot change the connection string for an OAConnection."
The Connection.ConnectionString is:
"data source=C:\Users\xxxx\MyFolder\testdb;failifmissing=True;enlist=False"
Connection.DataSource is:
"testdb"
When I try to modify the Connection.ConnectionString during runtime I get a System.InvalidOperationException:
"Cannot change the connection string for an OAConnection."
0
Accepted
Hi Erik,
Here is some sample code of how to specify the connection string at runtime
Ady
the Telerik team
Here is some sample code of how to specify the connection string at runtime
string
cs =
"data source=C:\\TestFolder\\testdb;failifmissing=True;enlist=False"
;
var context =
new
EntitiesModel(cs);
var schema = context.GetSchemaHandler();
Regards,Ady
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
0

Amelie
Top achievements
Rank 1
answered on 07 Apr 2015, 12:00 PM
I
hope it will helpful for you
http://sqliteviewer.blogspot.com/2015/04/create-sqlite-database-file.html
hope it will helpful for you
http://sqliteviewer.blogspot.com/2015/04/create-sqlite-database-file.html