OpenAccess validation

Thread is closed for posting
2 posts, 0 answers
  1. Alex Suutri
    Alex Suutri avatar
    2 posts
    Member since:
    Oct 2012

    Posted 25 Jan 2013 Link to this post

    Hello. I'm trying to evaluate OpenAccess ORM. I created internal interface with dataannotations and partial Bank class:
    internal interface IBank
            [Required(ErrorMessageResourceName = "BankNameMandatory", ErrorMessageResourceType = typeof(Resources))]
            [StringLength(50, ErrorMessageResourceName = "BankNameMaxLength",
                ErrorMessageResourceType = typeof(Resources))]
            string Name { get; set; }
            [Required(ErrorMessageResourceName = "BankCodeMandatory", ErrorMessageResourceType = typeof(Resources))]
            [StringLength(15, ErrorMessageResourceName = "BankCodeMaxLength",
                ErrorMessageResourceType = typeof(Resources))]
            string Code { get; set; }
            [StringLength(50, ErrorMessageResourceName = "BankAddressMaxLength",
                ErrorMessageResourceType = typeof(Resources))]
            string Address { get; set; }
            [StringLength(9, ErrorMessageResourceName = "BankExtraCodeMaxLength",
                ErrorMessageResourceType = typeof(Resources))]
            string ExtraCode { get; set; }
        public partial class Bank : IDataErrorInfo, IBank
             private readonly DataErrorInfoSupport _dataErrorInfoSupport;
             public Bank()
                 _dataErrorInfoSupport = new DataErrorInfoSupport(this);
             #region IDataErrorInfo Members
             public string Error
                 get { return _dataErrorInfoSupport.Error; }
             string IDataErrorInfo.this[string memberName]
                 get { return _dataErrorInfoSupport[memberName]; }

    But i cannot get error. What i'm doing wrong?
  2. Dimitar Tachev
    Dimitar Tachev avatar
    67 posts

    Posted 28 Jan 2013 Link to this post

    Hi Alex,

    In general one class could implement multiple interfaces that have the same properties with conflicting attributes on them. 

    In this particular case it cannot be determined which are the attributes that should take precedence and for this reason using interfaces with Data Annotations is not allowed.

    If it is applicable for you I suggest you to make the IBank interface an abstract class and inherit that class from the Bank one.

    I hope this helps. Do not hesitate to contact us back if you need any further assistance.

    Dimitar Tachev
    the Telerik team
    Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
Back to Top