Click here to Skip to main content
15,997,960 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I'm trying to use uniqueidentifier collumn as discriminator for TPH mapping of objects.
Fluent code configuration is like this:
C#
Map<ImplementationDocument>(m => m.Requires("DocumentType_ID").HasValue(Guid.Parse("A83EC21A-5661-462E-9539-F889F3BA2B5B"))).
           Map<WarrantyDocument>(m => m.Requires("DocumentType_ID").HasValue(Guid.Parse("E4A8F66F-E82D-E011-9483-00151710A8AC"))).
           Map<InvoiceDocument>(m => m.Requires("DocumentType_ID").HasValue(Guid.Parse("821BC287-E82D-E011-9483-00151710A8AC")));

As a result I'm getting mapping exception:
error 2016: Condition can not be specified on values of member 'DocumentType_ID'. Value conditions are not supported for type 'SqlServer.uniqueidentifier'.

Does it mean that this mapping scenario is totally impossible?
Posted
Updated 27-Jun-13 18:47pm
v2

1 solution

Ok, so the right configuration is following,I should simply give string values instead of parsed guid:
VB
Map<ImplementationDocument>(m => m.Requires("DocumentType_ID").HasValue("A83EC21A-5661-462E-9539-F889F3BA2B5B")).
            Map<WarrantyDocument>(m => m.Requires("DocumentType_ID").HasValue("E4A8F66F-E82D-E011-9483-00151710A8AC")).
            Map<InvoiceDocument>(m => m.Requires("DocumentType_ID").HasValue("821BC287-E82D-E011-9483-00151710A8AC"));
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900