1

Generated CodeFirst classes from working EDMX. When I try to connect database I get this error. it is looking for some columns which are not in the table. also these columns not in POCO and Fluent Mapping classes.

works fine with EDMX, have issue only with Codefirst

Why below columns are added in the query? is there any properties, method which can disable these columns getting included?

so because of this I get below error.

An error occurred while executing the command definition. See the inner exception for details.
Inner Exception:ORA-00904: "Extent1"."IsModified": invalid identifier

    public TestContext() :
        base(GetDefaultConnection(), true)
    {
        Database.SetInitializer<TestContext>(null);

        this.Database.Log = Console.Write; 
        Configure();
    }


SELECT 
"Extent1".USERID,
"Extent1".FIRST_NAME,
"Extent1".LAST_NAME,
"Extent1".EMAIL_ADDRESS,
"Extent1".PHONE_NO,
"Extent1".FAX_NO,
"Extent1".ID,
"Extent1"."DisableEvent",
"Extent1"."RowNumberValue",
"Extent1"."IsNew",
"Extent1"."IsModified"
FROM USERS "Extent1"
WHERE (((UPPER("Extent1".USERID)) = :p__linq__0) OR ((UPPER("Extent1".USERID) IS NULL) AND (:p__linq__0 IS NULL))) AND ROWNUM <= 1
-- p__linq__0: 'SYSADM' (Type = String, Size = 6)
-- Executing at 3/11/2015 14:25:40 +05:30

below columns not in actual table.

 "Extent1"."DisableEvent",
"Extent1"."RowNumberValue",
"Extent1"."IsNew",
"Extent1"."IsModified"
FROM USERS "Extent1" 
anand
  • 307
  • 3
  • 14

1 Answers1

0

Based on what I see, I can say that those rows are for UOW(Unit Of Work) implementation.

Basically those fields are used for Paging - RowNumberValue, IsNew is used to mark an entity which was added and IsModified is for an entity pending update.

If this answer is still correct then ef6 is not supported by ODP https://stackoverflow.com/a/23307234/79379

Community
  • 1
  • 1
radu florescu
  • 4,315
  • 10
  • 60
  • 92
  • but actual table doesn't have these columns. also fluent mapping class doesn't have these. looks like EF code includes them. – anand Mar 11 '15 at 09:45
  • Yes, they are included by framework for the purposes mentioned above. This is how an ORM works. – radu florescu Mar 11 '15 at 11:08
  • @Floradue88, but there should be some option not consider right. i face this issue only with codefirst approach for existing db. it works fine, with edmx approach. also i can't add these columns into my existing 400+ tables :( to use with codefirst approach – anand Mar 11 '15 at 11:53
  • You don't need to add them. You need to have a database first: https://www.asp.net/mvc/overview/getting-started/database-first-development/setting-up-database – radu florescu Mar 11 '15 at 12:18