I want to dynamically create a database using my DataContext's CreateDatabase Method. I have manually created mapping classes and tested them. But as soon as I add the Expression Column (see below) the creation fails with an SqlCeException and I am unable to find out the exact reason.
/// <summary>
/// The sum of ratings for this document.
/// </summary>
[Column]
public Nullable<float> RatingSum { get; set; }
/// <summary>
/// The number of times the document was rated.
/// </summary>
[Column]
public Nullable<float> RatingCount { get; set; }
/// <summary>
/// Average rating as calculated from RatingSum and RatingCount
/// </summary>
[Column(AutoSync=AutoSync.Never, IsDbGenerated=true, Expression = "RatingSum * RatingCount", DbType="REAL")]
public Nullable<float> Rating { get; set; }
Omitting DbType or changing it to FLOAT didn't help, AutoSync.Always doesn't help either, omitting AutoSync and IsDbGenerated attributes doesn't work either. What am I doing wrong? Or is this simply not supported for a dynamically created db?