This question is locked. New answers and comments are not allowed.
Hi,
I'm using the fluent API and am struggling to get IsDependent() and isManaged() to work properly. Here is a representative minimal configuration. With this deletes don't cascade, and the container isn't managed. (Note I'm using the latest release as of December).
This seems identical to the examples in the documentation... what could I be doing wrong?
Thanks,
Jason
I'm using the fluent API and am struggling to get IsDependent() and isManaged() to work properly. Here is a representative minimal configuration. With this deletes don't cascade, and the container isn't managed. (Note I'm using the latest release as of December).
This seems identical to the examples in the documentation... what could I be doing wrong?
Thanks,
Jason
public class User
{
public User()
{
this.QueryViews = new List<
QueryView
>();
}
public int Id { get; set; }
public string Name { get; set; }
public IList<
QueryView
> QueryViews { get; set; }
}
public class QueryView
{
public int Id { get; set; }
public string Name { get; set; }
public int OwnerId { get; set; }
public User Owner { get; set; }
}
MappingConfiguration<
User
> userConfiguration = new MappingConfiguration<
User
>();
userConfiguration.MapType(x => new
{
Id = x.Id,
Name = x.Name,
}).ToTable("Users");
userConfiguration.HasProperty(x => x.Id).IsIdentity(KeyGenerator.Autoinc);
userConfiguration.HasIndex(u => u.Name).IsUnique().WithName("Users_Name_Unique");
MappingConfiguration<
QueryView
> queryViewConfiguration = new MappingConfiguration<
QueryView
>();
queryViewConfiguration.MapType(x => new
{
Id = x.Id,
Name = x.Name,
Owner = x.OwnerId,
}).ToTable("QueryViews");
queryViewConfiguration.HasProperty(x => x.Id).IsIdentity(KeyGenerator.Autoinc);
queryViewConfiguration.HasAssociation(c => c.Owner).WithOpposite(u => u.QueryViews).HasConstraint((q, u) => q.OwnerId == u.Id).IsManaged().IsDependent().IsRequired();