Can I drop index on single interface implementation, if field was declared in interface? (same question for base type fields)

If can't, what do you think it is bug or not?

Example, after recreate in DB Ent and Ent2 has index Program.Ent.Program.IEnt.FK_E1 Program.Ent2.Program.IEnt.FK_E1

namespace Sample
{
    using System;
    using Xtensive.Orm;
    using Xtensive.Orm.Configuration;

    internal class Program
    {
        private static void Main(string[] args)
        {
            var dc = new DomainConfiguration("sqlserver", "Data Source=.; Initial Catalog=DO40-Tests; Integrated Security=True;")
            {
                UpgradeMode = DomainUpgradeMode.Recreate
            };

            dc.Types.Register(typeof(Program).Assembly);

            using (Domain.Build(dc))
            {
            }
        }

        public interface IEnt : IEntity
        {
            [Field]
            Ent E1 { get; set; }
        }

        [HierarchyRoot]
        public class Ent : Entity, IEnt
        {
            [Field, Key]
            public Guid Id { get; set; }

            [Field(Indexed = false)]
            public Ent E1 { get; set; }
        }

        [HierarchyRoot]
        public class Ent2 : Entity, IEnt
        {
            [Field, Key]
            public Guid Id { get; set; }

            public Ent E1 { get; set; }
        }
    }
}

asked Oct 12 '17 at 08:40

Gushchin%20Anton's gravatar image

Gushchin Anton
11272729


One Answer:

Hello Anton,

Unfortunately, you cannot override interface fields declaration. If you want different implementations to have different field settings you will have to declare [FieldAttribute] in each implementor.

I wouldn't say that it is a bug. It is just how it was implemented, with no overriding available.

answered Oct 16 '17 at 07:23

Alexey%20Kulakov's gravatar image

Alexey Kulakov
77225

Ok We will try bypass this misfortune

How I see it, new behaviour does not break current solutions. Can we hope that you will "fix" that? How hard would it be to add overriding for Indexed property?

(Oct 17 '17 at 10:03) Gushchin Anton Gushchin%20Anton's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA