Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Commented Issue: Confusing error message is thrown by .HasDeleteAction() [1212]

$
0
0
Repro:
1. New console application
2. PM> Install-package entityframework -pre -version 6.0.0-beta1-20531
3. replace Program.cs with attached file
4. Debug the application (F5)
NOTE: Exception is thrown and the action that it says is invalid, 'Restrict', is also in the list of valid actions

One of the error messages generated by this code looks like this:
(0,0) : error 0005: The 'Action' attribute is invalid - The value 'Restrict' is invalid according to its datatype 'http://schemas.microsoft.com/ado/2009/11/edm:TAction' - The Enumeration constraint failed.
(0,0) : error 0096: The Action Restrict on Comment_Parent_Target is not recognized. Valid actions are: None, Cascade, and Restrict.

Convention looks like this:
modelBuilder.Types<Comment>()
.Configure(c => c
.NavigationProperty(t => t.Parent)
.HasDeleteAction(OperationAction.Restrict));
Comments: Fixed in 23ba9d87176d EfHasNoRestrictions (CodePlex 1212: Remove OperationAction.Restrict) OperationAction.Restrict is not supported by EF. This changes removes all places (that I could find) where it is referred to.

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>