Open nickitatkach opened 7 years ago
@nickitatkach Can you share your code?
@Dixin Sure.
Here is Entity Type
public class ToDo
{
[Required]
[StringLength(128)]
public string Id { get; set; }
[StringLength(150)]
public string Title { get; set; }
public DateTime StartDate { get; set; }
public DateTime DueDate { get; set; }
public ToDoPriority Priority { get; set; }
public int Progress { get; set; }
}
Here is DbFunctions
[ModelDefinedFunction(nameof(ParseDecimal), "Namespace", "cast([ToDo].[Progress] as Decimal(20,8))")]
public static decimal ParseDecimal(this ToDo todo) => Convert.ToDecimal(todo.Progress);
Here is OnModelCreating
modelBuilder.AddFunctions<DbFunctions>()
When I change Priority
type from enum to int it works fine.
I'm having the same issue.
modelBuilder.ComplexType<ObjectContainingEnumProperty>();
Results in:
ObjectContainingEnumProperty for method MethodNameHere is not supported in conceptual model as a structural type. This can be caused by a failure to register this type as complex. For more information, see https://msdn.microsoft.com/en-us/library/gg679474.aspx
Same issue, confirmed.
Hello.
I am not able to create Model Defined Function if Entity Type uses Enum inside.
How I can fix this?
Thanks.