Hi.
Test project:
namespace ConsoleApplication1
{
using ConsoleApplication11;
using Xtensive.Orm;
using Xtensive.Orm.Configuration;
using Xtensive.Orm.Model;
class Program
{
static void Main(string[] args)
{
var cfg = new DomainConfiguration("sqlserver", "Data Source=localhost; Initial Catalog=do40-tests; Integrated Security=True;")
{
UpgradeMode = DomainUpgradeMode.Recreate,
ValidationMode = ValidationMode.OnDemand
};
cfg.Sessions.Add(new SessionConfiguration("Default")
{
BatchSize = 25,
DefaultIsolationLevel = SessionConfiguration.DefaultDefaultIsolationLevel,
CacheSize = 1000,
Options = SessionOptions.Default | SessionOptions.AutoTransactionOpenMode | SessionOptions.AutoTransactionSuppressMode
});
cfg.Types.Register(typeof(Program).Assembly);
var domain = Domain.Build(cfg);
}
}
[HierarchyRoot]
public class BaseEntity : Entity
{
[Field, Key]
public int Id { get; private set; }
}
/// <summary>
/// First entity
/// </summary>
[HierarchyRoot(InheritanceSchema = InheritanceSchema.SingleTable)]
[Index("TestField", "TestLink", Unique = true, Name = "DescendantA.IX_TestFieldTestLink")]
public class EntityA : Entity
{
[Field, Key]
public int Id { get; private set; }
/// <summary>
/// TestField
/// </summary>
[Field]
public string TestField { get; set; }
/// <summary>
/// TestLink
/// </summary>
[Field(Nullable = false)]
public EntityB TestLink { get; set; }
}
/// <summary>
/// Second entity
/// </summary>
[HierarchyRoot]
public class EntityB : Entity
{
[Field, Key]
public int Id { get; private set; }
/// <summary>
/// TestField
/// </summary>
[Field]
public string TestField { get; set; }
}
/// <summary>
/// Descendant
/// </summary>
[Index("Field", "TestField", Unique = true, Name = "DescendantA.IX_FieldTestField")]
[Index("Field", Unique = true, Name = "DescendantA.IX_Field")]
[Index("TestField", Unique = true, Name = "DescendantA.IX_TestField")]
public class DescendantA : EntityA
{
[Field]
public int Field { get; private set; }
}
}
From three indexes on DescendantA in DB creates only second one.
I think, it's logical with ClassTable scheme, but maybe should throw warning on update scheme step.
With ConcreateTable and SingleTable schemes, creates two indexes: second and third. First index ignored :(
asked
Mar 05 '12 at 03:21
Anton Guschin
73●30●30●35
Anton,
Thanks. We'll check this.
Have you any news?
ver2. Have you any news? This small bug is annoying (
ver3. Have you any news?
Konstantin, we are very sorry for the delay, we'are giving this annoying bug high priority and keep you informed about any progress.
Have you any progress?
We did the required investigation and found out that implementation of the feature you requested will take significant amount of time.
The reason: monstrous IndexBuilder must be almost rewritten, as there is a list of other issues concerning its improper functionality. Having that, we can only plan it for the next major release.
Is it safe to create that index outside of DO.NET as a workaround?
Hello Sebastian,
Yes, it is safe to create the index, however, it will be removed if
DomainUpgradeMode.Recreate
is used. InDomainUpgradeMode.Perform/PerformSafely
it can be also removed if changes are made to tables that are used in the index.Do you have any progress on this issue? By the way, I have a suggestion: if the administrator creates an external index (which was definitely created manually and not through the DO), then leave it alone as long as it can be.