Extending an entity framework 6 class

c# entity-framework entity-framework-6 partial-classes

Question

I have the Entity Framework-generated Person.cs class, which is located in the Project.Model namespace.

Then, I created a new folder named Extensions in the project, placed Person.cs inside of it, and set the namespace for this file to Project.Model.

When I try this, I experience the following error:

Type 'Project.Model.Person' already defines a member called 'Person' with the same parameter types.

Why am I misusing this? To add more properties, I need to extend EF Person.cs.

Here is my extended Person.cs code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Project.Model
{
    public partial class Person
    {
        public Person()
        {

        }
    }
}
1
3
5/12/2014 9:31:57 AM

Accepted Answer

ZZZ_tmp
4
5/12/2014 9:30:31 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow