Зачем наследовать от EntityObject?

Я использую Devart Entity Developer для моделирования своей базы данных для Entity Framework. Почему мои классы наследуются от EntityObject?

Я не вижу в какой-либо документации Entity Framework, что это ни требуется, ни лучшая практика.

Это пример сгенерированного класса:

//------------------------------------------------------------------------------
// This is auto-generated code.
//------------------------------------------------------------------------------
// This code was generated by Devart Entity Developer tool using Entity Framework EntityObject template.
// Code is generated on: 20.03.2016 12.01.45
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Core.Objects.DataClasses;

namespace Stackru.Example
{

    /// <summary>
    /// There are no comments for Stackru.Example.Purchase in the schema.
    /// </summary>
    /// <KeyProperties>
    /// PurchaseId
    /// </KeyProperties>
    [EdmEntityTypeAttribute(NamespaceName="Donate.Models.Entities", Name="Purchase")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Purchase : EntityObject    {
        #region Factory Method

        /// <summary>
        /// Create a new Purchase object.
        /// </summary>
        /// <param name="purchaseId">Initial value of PurchaseId.</param>
        public static Purchase CreatePurchase(int purchaseId)
        {
            Purchase purchase = new Purchase();
            purchase.PurchaseId = purchaseId;
            return purchase;
        }

        #endregion

        #region Properties

        /// <summary>
        /// There are no comments for PurchaseId in the schema.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        [System.ComponentModel.DataAnnotations.Key]
        [System.ComponentModel.DataAnnotations.Required()]
        public int PurchaseId
        {
            get
            {
                int value = _PurchaseId;
                OnGetPurchaseId(ref value);
                return value;
            }
            private set
            {
                if (_PurchaseId != value)
                {
                  OnPurchaseIdChanging(ref value);
                  ReportPropertyChanging("PurchaseId");
                  _PurchaseId = StructuralObject.SetValidValue(value);
                  ReportPropertyChanged("PurchaseId");
                  OnPurchaseIdChanged();
              }
            }
        }
        private int _PurchaseId;
        partial void OnGetPurchaseId(ref int value);
        partial void OnPurchaseIdChanging(ref int value);
        partial void OnPurchaseIdChanged();

        #endregion
    }

}

0 ответов

Другие вопросы по тегам