Click here to Skip to main content
15,897,718 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I am facing one issue with Table Mapping in Entity Framework 4.1.
I have a table name Promotion having column intDeletedBy and datDeletedOn
and i want to fetch only those records from DB which are not deleted

but when i map the table with entity frame work for the column intDeletedBy or datDeletedOn
i am getting an error message on the condition tag

Quote:
Error 3032: Problem in mapping fragments starting at line 261:Condition member 'CMS_Promotion.datDeletedOn' with a condition other than 'IsNull=False' is mapped. Either remove the condition on CMS_Promotion.datDeletedOn or remove it from the mapping.


my xml code is in C-S mapping content

XML
<EntitySetMapping Name="Promotions">
           <EntityTypeMapping TypeName="Lorenz_dataModel.Promotion">
             <MappingFragment StoreEntitySet="CMS_Promotion">
               <ScalarProperty Name="PromotionId" ColumnName="autPromotionId" />
               <ScalarProperty Name="Name" ColumnName="vchName" />
               <ScalarProperty Name="Description" ColumnName="vchDescription" />
               <ScalarProperty Name="ValidFrom" ColumnName="datValidFrom" />
               <ScalarProperty Name="ValidTo" ColumnName="datValidTo" />
               <ScalarProperty Name="CreatedBy" ColumnName="intCreatedBy" />
               <ScalarProperty Name="CreatedOn" ColumnName="datCreatedOn" />
               <ScalarProperty Name="ModifiedBy" ColumnName="intModifiedBy" />
               <ScalarProperty Name="ModifiedOn" ColumnName="datModifiedOn" />
               <ScalarProperty Name="DeletedBy" ColumnName="intDeletedBy" />
               <ScalarProperty Name="DeletedOn" ColumnName="datDeletedOn" />
               <Condition ColumnName="datDeletedOn" IsNull="true"/>
             </MappingFragment>
           </EntityTypeMapping>
         </EntitySetMapping>


pls suggest me how can i overcome from this issue.
I dont want to change the datatype of my db table

waiting for reply
Thanks
Posted

1 solution

you can declare datatype as nullable for columns you expect to be null

please refer this as reference[^] for same.
 
Share this answer
 

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