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

  • Home
  • SEARCH
  • 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 8496969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:59:38+00:00 2026-06-10T23:59:38+00:00

Here are the generated models: public class DbObjectMap : EntityTypeConfiguration<DbObject> { public DbObjectMap() {

  • 0

Here are the generated models:

public class DbObjectMap : EntityTypeConfiguration<DbObject>
{
    public DbObjectMap()
    {
        // Primary Key
        HasKey(t => new { t.Type, CompanyName = t.CompanyName, Id = t.Id });

        // Properties
        Property(t => t.Timestamp)
            .IsRequired()
            .IsFixedLength()
            .HasMaxLength(8)
            .IsRowVersion();

        Property(t => t.Type)
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

        Property(t => t.CompanyName)
            .IsRequired()
            .HasMaxLength(30);

        this.Property(t => t.Id)
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

        this.Property(t => t.Name)
            .IsRequired()
            .HasMaxLength(30);

        this.Property(t => t.VersionList)
            .IsRequired()
            .HasMaxLength(80);

        this.Property(t => t.LockedBy)
            .IsRequired()
            .HasMaxLength(132);

        // Table & Column Mappings
        this.ToTable("Object");
        this.Property(t => t.Timestamp).HasColumnName("timestamp");
        this.Property(t => t.Type).HasColumnName("Type");
        this.Property(t => t.CompanyName).HasColumnName("Company Name");
        this.Property(t => t.Id).HasColumnName("ID");
        this.Property(t => t.Name).HasColumnName("Name");
        this.Property(t => t.Modified).HasColumnName("Modified");
        this.Property(t => t.Compiled).HasColumnName("Compiled");
        this.Property(t => t.BlobReference).HasColumnName("BLOB Reference");
        this.Property(t => t.BlobSize).HasColumnName("BLOB Size");
        this.Property(t => t.DbmTableNo).HasColumnName("DBM Table No_");
        this.Property(t => t.Date).HasColumnName("Date");
        this.Property(t => t.Time).HasColumnName("Time");
        this.Property(t => t.VersionList).HasColumnName("Version List");
        this.Property(t => t.Locked).HasColumnName("Locked");
        this.Property(t => t.LockedBy).HasColumnName("Locked By");
    }
}

and:

{
    public ObjectTrackingMap()
    {
        // Primary Key
        HasKey(t => new { ObjectType = t.ObjectType, Id = t.Id, ChangeType = t.ChangeType });

        // Properties
        Property(t => t.Timestamp)
            .IsRequired()
            .IsFixedLength()
            .HasMaxLength(8)
            .IsRowVersion();

        Property(t => t.ObjectType)
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

        Property(t => t.Id)
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

        Property(t => t.ChangeType)
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);



        // Table & Column Mappings
        ToTable("Object Tracking");
        Property(t => t.Timestamp).HasColumnName("timestamp");
        Property(t => t.ObjectType).HasColumnName("Object Type");
        Property(t => t.Id).HasColumnName("Object ID");
        Property(t => t.ChangeType).HasColumnName("Change Type");
        Property(t => t.ObjectTimestamp).HasColumnName("Object Timestamp");
    }
}

These two objects don’t have any relation in database tables. But they could be joined by
Object.Type = ObjectTracking.ObjectType and Object.ID = ObjectTracking.ObjectID fields.

Is there any way to create correct mapping in EF using FluentAPI for these two entities?

  • 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-10T23:59:40+00:00Added an answer on June 10, 2026 at 11:59 pm

    Easiest way is with Visual Studio – just open your EDMX file in graphic designer mode (double click it), activate Toolbox and Properties windows (in View menu on top), selct “Association” from Toolbox and drag-draw your relation from one table to another, than tweak it in the properties window.

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

Sidebar

Related Questions

I have a complex type, with all string properties // Actual class is auto-generated
here's the code(Where I think the NullPointerException is generated): public String getData(String s1,String s2,String
I have an almost new setup of ROR 3.1 here and have already generated
I have an employee class generated by Entity Framework (EF). public partial class employee
Say I have the following models: public class Item { public int Id{ get;
I have the following class: namespace Storage.Models { public class AdminDetail { public string
I'm unable to query any object by the DateTime properties. public class MyModel {
I have this code try { //AN EXCEPTION IS GENERATED HERE!!! } catch {
Here is part 1 of our problem (Loading a dynamically generated XML file as
Here's a starter list: if hbm is hand generated, is it an embedded resource?

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.