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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:51:49+00:00 2026-05-30T12:51:49+00:00

I have two app. The one use XAF (devexpress framework), the second use asp.net

  • 0

I have two app. The one use XAF (devexpress framework), the second use asp.net mvc.
My bussines classes is created in XAF app. Both use same database.
My classes in XAF:

    public class BaseClass:XPObject
    {
    // some fields
    }

    // This attribute mean that all fields will be stored in BaseClass table
    [MapInheritance(InheritanceType.ParentTable] 
    public class Class1:BaseClass
    {
    // some fields
    }

   // This attribute mean that all fields will be stored in BaseClass table
    [MapInheritance(InheritanceType.ParentTable] 
    public class Class2:BaseClass
    {
    // some fields
    }

In a DB we have one table: BaseClass with fields from BaseClass, Class1.

There are such moment: XAF adding own field called ObjectType (it’s FK to XPObjectType table which XAF create automatically).
In result we have in a DB:

BaseClass:

ID      some_fields_from_BaseClass      some_fields_from_Class1      ObjectType
1             some_values                    some_values                1

XPObjectType:
ID                TypeName                    AssemblyName
1             TestApp.Module.BO.Class1       TestApp.Module 

Now, I wrote in the ASP.NET MVC app:

Database.BaseClasses.Where( ...some predicate...).ToList();

This query return me collection of BaseClass. But, I want that query return me derived types (Class1 or Class2 or Class 3, for example).
How can I do this?

PS. I can’t use IsDiscriminator attribute because it’s FK and I don’t want to diplicate objects (Class1, class2 in asp.net mvc app).

  • 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-30T12:51:50+00:00Added an answer on May 30, 2026 at 12:51 pm

    Try this one:

    public List<T> GetData<T>(Func<T,bool> fn) where T :BaseClass
        {
            if (typeof(T) == typeof(BaseClass))
            {
                List<T> res = null; // Fillout from database
                var r = res.Where(fn).Select(o => (BaseClass)o).ToList();
            }
            else
            {
                throw new Exception("Invalid type, this service support only BaseClasses");
            }
    
            return null;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Asp.net MVC app, I have two methods on a controller, one for
I have two applications one a console application and the other an ASP.NET app.
I have an ASP.NET web app where I use an ado sql connection to
I have ASP.NET GridView in my web app and would like to bind two
Is it possible to have two app.config files where one app.config serves as a
In my iPhone app, I have two plist files to store Themes. One is
I am working on a simple Core Data app. I have two classes: Client
I'm currently developing an iPhone app where I have two UITextField's in one View
I have an existing ASP.NET web application that I'm converting to MVC 1.0. The
I have a situation where I have two arrays and I use one array(A)

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.