Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5969075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:10:45+00:00 2026-05-22T20:10:45+00:00

Goal: To use entity framework with N-tier in my WPF application. Problem: I can’t

  • 0

Goal:
To use entity framework with N-tier in my WPF application.

Problem:
I can’t merge the class Product from the map ProductRepository to entity framework that also has a class named Product.

When I tried solving the problem I always retrieve this error message:

Error 1 Cannot implicitly convert type
‘System.Collections.Generic.List’
to
‘System.Collections.Generic.List’ D:\Arbete\kurser\C#.NET\Labbar\Lab3\ny\MediaStore\DataAccessLibrary\ProductRepository\ProductRepository.cs 45 20 DataAccessLibrary

Just a little reminder:
I would like to the class Product to be flexible that also can be used in business and presentation layer.

namespace DataAccessLibrary.ProductRepository
{

    public partial class Product
    {
        public Int32 ArticleNumber_id { get; set; }
        public string Name { get; set; }
        public decimal SalePrice { get; set; }
        public decimal PurchasePrice { get; set; }
        //public string Book_url { get; set; }
        public Int32 ProductCategory_id { get; set; }
        public Int32 Supplier_id { get; set; }
        public Int32 Role_id { get; set; }

    }
}

namespace DataAccessLibrary.ProductRepository
{

    /// <summary>
    /// Responsible for uppdating, adding, deleting, retrieving data from product list.
    /// </summary>
    public class Productrepository : IProductrepository
    {

        private List<Product> myProductList;

        private MediaStoreEntities _myMediaStoreEntities = new MediaStoreEntities();

        public Productrepository()
        {
            myProductList = new List<Product>();
        }

        /// <summary>
        /// Retrieve all data from the product list
        /// </summary>
        /// <returns>A list with full of product data.</returns> 
        public List<Product> GetAllProductList()
        {
            var productListt = (from a in _myMediaStoreEntities.Products
                                          select a).ToList();

            return productListt;
            //return productList;   
        }
    }
}

Class: ProductRepository
Namespace: DataAccessLibrary.ProductRepository

/// <summary>
/// Retrieve all data from the product list
/// </summary>
/// <returns>A list with full of product data.</returns> 
public List<Product> GetAllProductList()
{
    var productListt = (from a in _myMediaStoreEntities.Products
                                  select a).ToList();

    return productListt;
    //return productList;   
}

aaa
bbb
ccc

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:10:46+00:00Added an answer on May 22, 2026 at 8:10 pm

    That is because you have two Product classes. One in ProductRepository namespace and second in Database namespace. Both partial parts must be in the same namespace to form a single class.

    If you are trying to use custom POCO class (only EFv4) you must turn off automatic code generation (you didn’t because you have still .Designer.cs file under your EDMX) by removing custom tool in the designer. Then you must create custom context class derived from ObjectContext which will expose ObjectSet<DataAccessLibrary.ProductRepository.Product>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my goal is to get lots of rows from a translation table. I use
The goal: To create a .NET dll i can reference from inside SQL Server
I'm in VS2008 with Entity Framework. I'm accessing objects from the database using esql
Note: I do NOT want to use any framework. The goal is just to
My goal is to maintain a web file server separately from my main ASP.NET
my goal is to write a stored proc that can collect all field values
My goal is to recognize simple gestures from accelerometers mounted on a sun spot.
Entity framework maps DB types to .NET types, for instance SQL Server's BigInt is
My goal is to use CSS ONLY for some tooltips. I like the solution
My goal is pretty simple: to use ant to build an EAR which contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.