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 733161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:13:31+00:00 2026-05-14T07:13:31+00:00

using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace EfTestFactory { public abstract class

  • 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace EfTestFactory
{
    public abstract class _Company
    {
        public abstract List<Personel> GetPersonel();

        public abstract List<Prim> GetPrim();

        public abstract List<Finans> GetFinans();
    }

    public abstract class _Radyoloji
    {
        public abstract List<string> GetRadyoloji();
    }
    public abstract class _Satis
    {
        public abstract List<string> GetSatis();
    }
    public abstract class _Muayene
    {
        public abstract List<string> GetMuayene();
    }

    public class Company : _Company
    {

        public override List<Personel> GetPersonel()
        {
            throw new NotImplementedException();
        }

        public override List<Prim> GetPrim()
        {
            throw new NotImplementedException();
        }

        public override List<Finans> GetFinans()
        {
            throw new NotImplementedException();
        }
    }

    public class Radyoloji : _Radyoloji
    {
        public override List<string> GetRadyoloji()
        {
            throw new NotImplementedException();
        }
    }

    public class Satis : _Satis
    {
        public override List<string> GetSatis()
        {
            throw new NotImplementedException();
        }
    }

    public class Muayene : _Muayene
    {
        public override List<string> GetMuayene()
        {
            throw new NotImplementedException();
        }
    }



    public class GenoTipController
    {
        public object CreateByEnum(DataModelType modeltype)
        {
            string enumText = modeltype.ToString(); // will return for example "Company"
            Type classType = Type.GetType(enumText); // the Type for Company class
            object t = Activator.CreateInstance(classType); // create an instance of Company class
            return t;
        }
    }

    public class AntsController
    {
        static Dictionary<DataModelType, Func<object>> s_creators =
            new Dictionary<DataModelType, Func<object>>()
            {
                { DataModelType.Radyoloji,  () => new _Radyoloji() },
                { DataModelType.Company,    () => new _Company() },
                { DataModelType.Muayene,    () => new _Muayene() },
                { DataModelType.Satis,      () => new _Satis() },
            };

        public object CreateByEnum(DataModelType modeltype)
        {
            return s_creators[modeltype]();
        }
    }

   public class CompanyView
    {
        public static List<Personel> GetPersonel()
        {
            GenoTipController controller = new GenoTipController();
            _Company company = controller.CreateByEnum(DataModelType.Company) as _Company;
            return company.GetPersonel();
        }
    }

    public enum DataModelType
    {
        Radyoloji,
        Satis,
        Muayene,
        Company
    }
}

if i write above codes i see some error: Cannot create an instance of abstract class or interface ‘EfTestFactory_Company’How can i solve it? Look please below pic.alt text

  • 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-14T07:13:31+00:00Added an answer on May 14, 2026 at 7:13 am

    You cannot instantiate abstract classes. You could instantiate only concrete classes:

    static Dictionary<DataModelType, Func<object>> s_creators =
        new Dictionary<DataModelType, Func<object>>()
        {
            { DataModelType.Radyoloji,  () => new Radyoloji() },
            { DataModelType.Company,    () => new Company() },
            { DataModelType.Muayene,    () => new Muayene() },
            { DataModelType.Satis,      () => new Satis() },
        };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 508k
  • Answers 508k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Think of Ado.net as a managed library that provides all… May 16, 2026 at 4:19 pm
  • Editorial Team
    Editorial Team added an answer Use UniqueId. Since you can have multiple server controls with… May 16, 2026 at 4:19 pm
  • Editorial Team
    Editorial Team added an answer Now i don't get why a and &a return the… May 16, 2026 at 4:19 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

This is my problem: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Data; using System.Data.SqlClient;
I have this code for the controller in /Controllers/Cubo/FilterController.cs using System; using System.Collections.Generic; using
hi this is my multi thread codes it works fine using System; using System.Collections.Generic;
I am trying to create a generic method using EF4 to find the primary
I want to load a DropDownList with possible Paises from my database. using System;
Trying to create a list to return some JSON data to a view. Following
I am experimenting with security-trimmed action links in ASP.NET MVC, and am considering using
I would like to sort my list with the date property. This is my
I decided to try out LINQ for the first time to try and solve

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.