With Entity Framework's Code-First approach, how do I migrate this class to a dotted table named 'Entity.Student' in SQLite3? Is this possible?
I am currently using dotConnect for SQLite Pro v5.1.80.0 with Entity Framework v6.0.2
I know that SQLite supports a dotted table name, for example:
Code: Select all
sqlite> CREATE TABLE [123abc](col);
sqlite> CREATE TABLE [123abc.txt](col);
sqlite> CREATE TABLE [123abc-ABC.txt](col);
sqlite> select tbl_name from sqlite_master;
123abc
123abc.txt
123abc-ABC.txt
Code: Select all
<DbConfigurationType(GetType(Devart.Data.SQLite.Entity.SQLiteEntityProviderServicesConfiguration))> _
Public Class SQLiteContext
Inherits DbContext
Public Sub New()
MyBase.New("SQLiteDb")
End Sub
Public Property Students As DbSet(Of Student)
End Class
Code: Select all
Public Class Student
Private _StudentId As Int32
Public Property StudentId() As Int32
Get
Return _StudentId
End Get
Set(ByVal value As Int32)
_StudentId = value
End Set
End Property
Private _Name As String
Public Property Name() As String
Get
Return _Name
End Get
Set(ByVal value As String)
_Name = value
End Set
End Property
End Class
Code: Select all
<Table("[Entity.Students]")> _
Public Class Student
...
End Class
Code: Select all
Public Partial Class SQLITE_add_students_table_test
Inherits DbMigration
Public Overrides Sub Up()
CreateTable(
"dbo.[Entity.Students]",
Function(c) New With
{
.StudentId = c.Int(nullable := False, identity := True),
.Name = c.String()
}) _
.PrimaryKey(Function(t) t.StudentId)
End Sub
Public Overrides Sub Down()
DropTable("dbo.[Entity.Students]")
End Sub
End Class
I also tried removing the 'dbo.' like this,The multi-part identifier 'dbo.[Entity.Students]' could not be used. Use two-part identifier instead.
Code: Select all
Partial Public Class SQLITE_add_students_table_test
Inherits DbMigration
Public Overrides Sub Up()
CreateTable(
"[Entity.Students]",
...
) _
.PrimaryKey(Function(t) t.StudentId)
End Sub
Public Overrides Sub Down()
DropTable("[Entity.Students]")
End Sub
End Class
Am I missing something here?SQLite error
unknown database "[Entity"
Thanks Guru,