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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:35:26+00:00 2026-06-06T16:35:26+00:00

I trying to create inheritance so I can have some super classes with general

  • 0

I trying to create inheritance so I can have some super classes with general properties and then more specialized classes that are the ones getting used.

I want something like the Table per type or table per class they make here http://www.codeproject.com/Articles/232034/Inheritance-mapping-strategies-in-Fluent-Nhibernat

So I have my supertype Game here

    public abstract class Game
{
    public virtual int Id { get; set; }
    public virtual List<UserGame> UserList { get; set; }
}

public class GameMap : ClassMap<Game>
{
    public GameMap()
    {
        Id(x => x.Id, "GameId")
            .GeneratedBy
            .HiLo("100");
        HasMany(x => x.UserList)
           .Cascade.All();
    }
}

And then my specialized class here QMGameActive

    public class QMGameActive : Game
{
    public virtual DateTime LastUpdate { get; set; }
    public virtual string SelectedBrick { get; set; }
    public virtual int Score { get; set; }
    public virtual string History { get; set; }
    public virtual int StartingPlayerId { get; set; }

    public QMGameActive() 
    {
        LastUpdate = DateTime.Now;
        History = "";
        SelectedBrick = "";
    }
}

public class QMGameActiveMap : SubclassMap<QMGameActive>
{
    public QMGameActiveMap()
    {
        KeyColumn("GameId");
        Map(x => x.LastUpdate);
        Map(x => x.SelectedBrick);
        Map(x => x.Score);
        Map(x => x.History);
        Map(x => x.StartingPlayerId);
    }
}

But when I get a diagram from the server I can see there is no connection between Game and QMGameActive there

enter image description here

So what am I missing to make it use inheritance?

  • 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-06-06T16:35:29+00:00Added an answer on June 6, 2026 at 4:35 pm

    I am fairly sure that if you KeyColumn(“GameId”); from the QMGameActiveMap() then NHibernate will generate QMGameActive with an ID Column of GameID which will be a foreign key of Game.GameId. which would seem to give you what you want.

    (sorry away from home and cannot try code out to make sure).

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

Sidebar

Related Questions

How can I do inheritance with this example. I'm trying to create an object
I am trying to create a new class Dog that inherits via prototypical inheritance
I edited some mistakes and details... Well, I have been trying to create a
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
I'm trying to create Class Table Inheritance as in ( http://www.castleproject.org/activerecord/documentation/trunk/usersguide/typehierarchy.html ) So let's
I'm trying to wrap my head around multiple inheritance in python. Suppose I have
I am trying to set up Entity Inheritance using JPA annotations and abstract classes.
I seem to have forgotten some of the most basic rules of inheritance because
i've been experimenting with javascript's prototypal inheritance and have come across something that perhaps
When I do inheritance in JS, I find extra properties in the derived classes

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.