I use the Firebird 2.1 database along with VS2010 (.NET 4.0) and try to get it to work with the entity infrastructure.
The problem is that when creating an object from a database table, the framework detects that all columns are part of the primary key. The table is very simple with two whole columns, one of which is set as the primary key.
I even have "# PK_GEN #" set as a comment for the primary key column.
In the EF editor, I cannot change the primary key property for the store object, and since I have to deal with columns with a null value, this is a problem. I can edit the XML-code of the model file, but when updating the model, the changes are not saved, so this is a show stopper.
Since I only read about similar issues regarding views, not tables, I obviously am doing something wrong, but I can't figure it out.
edit: By the way, I just checked the behavior with VS 2012 and remained unchanged.
Here is the CREATE script. Since I'm new to Firebird, maybe something is wrong here and here, but I really don't think so.
CREATE GENERATOR GEN_TESTTABLE_ID; CREATE TABLE TESTTABLE ( TESTTABLE_ID INTEGER NOT NULL, VALUE INTEGER ); ALTER TABLE TESTTABLE ADD CONSTRAINT PK_TESTTABLE PRIMARY KEY (TESTTABLE_ID); COMMENT ON COLUMN TESTTABLE.TESTTABLE_ID IS '#PK_GEN#'; SET TERM ^ ; CREATE OR ALTER TRIGGER TESTTABLE_BI_GEN_ID FOR TESTTABLE ACTIVE BEFORE INSERT POSITION 0 AS begin if ((new.testtable_id is null) or (new.testtable_id = 0) ) then begin new.testtable_id = gen_id(gen_testtable_id, 1); end end ^ SET TERM ; ^
source share