Xpode.com        Click here to Print this article.

LINQ and Entity framework Interview question - What are POCO classes in Entity framework?

POCO means Plain old C# object. When EDMX creates classes they are cluttered with lot of entity tags. For instance below is a simple customer class generated using entity framework. Many times we would like to use simple .NET classes and integrate the same with entity framework.

Entity framework allows the same. In other you can create a simple .NET class and use the entity context object to load your simple .NET classes.

[EdmEntityTypeAttribute(NamespaceName="CustomermytestModel", Name="Customer")]

    [Serializable()]

    [DataContractAttribute(IsReference=true)]

    public partial class Customer : EntityObject

    {

        #region Factory Method

 

        /// <summary>

        /// Create a new Customer object.

        /// </summary>

        /// <param name="id">Initial value of the Id property.</param>

        /// <param name="customerCode">Initial value of the CustomerCode property.</param>

        /// <param name="customername">Initial value of the Customername property.</param>

        public static Customer CreateCustomer(global::System.Int32 id, global::System.String customerCode, global::System.String customername)

        {

            Customer customer = new Customer();

            customer.Id = id;

            customer.CustomerCode = customerCode;

            customer.Customername = customername;

            return customer;

        }

 

        #endregion

        #region Primitive Properties

This question is taken from .NET interview questions book .

Below is a great ADO.NET Entity framework interview question video created by www.questpond.com which shows how to do CRUD using Entity framework.



http://
http://www.questpond.com/

Contributed by:
Shivprasad koirala Koirala
I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small E-learning company in India. We are very much active in making training videos , writing books and corporate trainings. Do visit my site http://www.questpond.com for .NET, C# , design pattern , WCF , Silverlight , LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server training and Interview questions and answers

Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=684

Click here to go on website