I am testing EF6 code first against a simple table in an existing SQL Anywhere 12.0.1 database. I tested DB first and had no problems querying with that method. But my attempts with code first won't work.
Here's the table:
CREATE TABLE "DBA"."COUNTRY" ( "country_id" char(2) NOT NULL ,"name" char(30) NOT NULL ,"country_code" varchar(3) NULL ,PRIMARY KEY ("country_id") ) go
Imagine the data in the table as
The model class:
<Table("COUNTRY")> Partial Public Class COUNTRY <Key> Public Property country_id As String Public Property name As String Public Property country_code As String End Class
And the DbContext class:
Partial Public Class MyEntities Inherits DbContext
When I attempt to do code like the following:
lstCountry.Count returns zero... What am I doing wrong?
Oh man... I'm so stupid. :)
I just needed to add the schema to table attribute.
So... anyway to assign a default schema to EF mappings?
answered 04 Jun '15, 16:18