So I've been trying to setup Effort and am not having much success. Looking on their site and people's comments it looks pretty straightforward.
I started small because I just wanted to test if it works. The error I get is "Sequence contains no matching element"
I've added a constructor like so to the dbcontext.
public ApplicationDbContext(DbConnection connection)
: base(connection, true)
{
}
My setup like so for my test
var connection = Effort.DbConnectionFactory.CreateTransient();
var context = new ApplicationDbContext(connection );
Just a test to see if it works
context.Set<MyType>().Add(new MyType() {Description = "test"});
Class for MyType
public class MyType
{
[Key]
public byte Id { get; set; }
[Required, MaxLength(50)]
public string Description { get; set; }
}
I have also tried this with the createpersistent. Same result.
I am using ef6 code first, mvc 5, .net 462.
Found the problem I had another data model with a property containing the following annotation. It didn't like it. Commented it out and it worked.
[Column(TypeName = "XML")]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.