Page 1 of 1

cannot use space as a value for a not null field.

Posted: Tue 05 Oct 2010 08:39
by andrelau
Hello.

The database we use is not designed by us.
In one table, the Key is composed of 4 fields and for some of them, " " (space) is a correct and meaning value.

So we assign the space value to the C# field and when we save it crash
=> The xxxxxx Field is required.

EF Bug ?
Any solution to overide the "trim effect" ?

Posted: Tue 05 Oct 2010 11:22
by AndreyR
I have made a test using both Devart Entity model and Microsoft Entity Framework model and succeeded to insert an entity with the varchar2 key equal to " ".
Could you please send us a small test project illustrating the problem?
If possible, please include the information about the database layer (DDL script would be a great option).

Posted: Tue 05 Oct 2010 12:04
by andrelau
It's a C#project, EntityFW model.

CREATE TABLE "TABxxxx"
(
"keypart1" CHAR(8 BYTE) NOT NULL ENABLE,
"keypart2" CHAR(8 BYTE) NOT NULL ENABLE,
"keypart3" CHAR(3 BYTE) NOT NULL ENABLE,
"keypart4" CHAR(2 BYTE) NOT NULL ENABLE,
"keypart5" CHAR(3 BYTE) NOT NULL ENABLE,
some other fields,....
CONSTRAINT "TABxxxx_PK" PRIMARY KEY ("keypart3", "keypart2", "keypart4", "keypart5", "keypart1") ENABLE )

Mapping is made as

keypart5 : CHAR keypart5 : String

Posted: Tue 05 Oct 2010 13:47
by andrelau
We noticed another problem. (and this may be related).

The Database field is char( 8 ) and filled with 8 spaces.
When we read the field we get "" instead of " " (8 spaces) ?

We're using EF4, Riaservices.

Posted: Fri 08 Oct 2010 11:29
by AndreyR
We have replied you by e-mail.

Posted: Mon 18 Oct 2010 09:42
by Shalex