[Firebird-net-provider] [EF] How to map Char(1) to Bool

2008-12-20 Thread Dmitry Studinsky
Hi,
I tried to use entity framework. In the my DB i have boolean column. I use
next domain:
CREATE DOMAIN T_BOOL AS
CHAR(1) CHARACTER SET UTF8
DEFAULT '0'
NOT NULL
CHECK (value in ('0', '1'))
COLLATE UTF8;

I created model from my DB. I see property in the model with type String. I
changed type to Boolean. As result i have exception:
Member Mapping specified is not valid. The type
'Edm.Boolean[Nullable=False,DefaultValue=]' of member 'FILLPIECES' in type
'Prowork.Dal.ASSEMBLY' is not compatible with
'FirebirdClient.char[Nullable=False,DefaultValue=,MaxLength=1,Unicode=False,FixedLength=True]'
of member 'FILLPIECES' in type 'Prowork.Dal.Store.ASSEMBLY'.

I tried to use Integer type for column in the DB. But EF also cannot convert
it to Boolean.
I did small research. And found examples
http://blogs.msdn.com/jkowalski/archive/2008/06/23/sample-entity-framework-provider-for-oracle.aspx
I looked provider by reflector, class FbProviderManifest. It does not
contain any code for recognizing Char(1). And i agree with this.

Question. How can i customize maping?

Thanks. 




--
___
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider


Re: [Firebird-net-provider] [EF] How to map Char(1) to Bool

2008-12-20 Thread Jiri Cincura
Bool is mapped to smallint.

-- 
Jiri {x2} Cincura (CTO x2develop.com)
http://blog.vyvojar.cz/jirka/ | http://www.ID3renamer.com

--
___
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider


Re: [Firebird-net-provider] [EF] How to map Char(1) to Bool

2008-12-20 Thread Dmitry Studinsky
Hi,
 Bool is mapped to smallint.
Created new domain
CREATE DOMAIN T_BOOL2 AS SMALLINT NOT NULL CHECK (value in (0,1));
and column SYMMETRIC T_BOOL2
And again have error:
Member Mapping specified is not valid. The type 
'Edm.Boolean[Nullable=False,DefaultValue=]' of member 'SYMMETRIC' in type 
'Prowork.Dal.ASSEMBLY' is not compatible with 
'FirebirdClient.smallint[Nullable=False,DefaultValue=]' of member 
'SYMMETRIC' in type 'Prowork.Dal.Store.ASSEMBLY'

Below you can see piece of edmx. Maybe it helps to find problem
!-- SSDL content --

EntityType Name=ASSEMBLY

Key

PropertyRef Name=IDASSEMBLY /

/Key

Property Name=IDASSEMBLY Type=int Nullable=false /

Property Name=NAME Type=varchar Nullable=false MaxLength=50 /

Property Name=DESCRIPTION Type=varchar MaxLength=512 /

Property Name=SYMMETRIC Type=smallint Nullable=false/

/EntityType



!-- CSDL content --

EntityType Name=ASSEMBLY

Key

PropertyRef Name=IDASSEMBLY /

/Key

Property Name=IDASSEMBLY Type=Int32 Nullable=false /

Property Name=Name Type=String Nullable=false MaxLength=50 
Unicode=true FixedLength=false /

Property Name=DESCRIPTION Type=String MaxLength=512 Unicode=true 
FixedLength=false /

Property Name=SYMMETRIC Type=Boolean Nullable=false /

/EntityType




--
___
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider


Re: [Firebird-net-provider] [EF] How to map Char(1) to Bool

2008-12-20 Thread Jiri Cincura
You have to tweak SSDL, of course. :) Change datatype for these
columns to smallint_bool. There's no way, how can I know, that you
will be mapping _this_ smallint to bool and the other one.

-- 
Jiri {x2} Cincura (CTO x2develop.com)
http://blog.vyvojar.cz/jirka/ | http://www.ID3renamer.com

--
___
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider


Re: [Firebird-net-provider] [EF] How to map Char(1) to Bool

2008-12-20 Thread Jiri Cincura
BTW the 1/0 = true/false is transparent in .NET, so you can use it
also without tweaking.

-- 
Jiri {x2} Cincura (CTO x2develop.com)
http://blog.vyvojar.cz/jirka/ | http://www.ID3renamer.com

--
___
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider