Mukarram Siddiqui

Mukarram Siddiqui

  • NA
  • 127
  • 530

Can we use a model class as a base class for another model class?

Sep 29 2021 3:36 PM

Can we use a model class A as a base class for another model class B with different schemas?

e.g: 

Model Class A.cs

namespace ABC.Models

{

[Table("tbl_A")]

public class A

{

public int ID { get; set; }

public string Title { get; set; }

public DateTime ReleaseDate { get; set; }

public string Genre { get; set; }

public decimal Price { get; set; }

}

}

 

Another model class.

namespace ABC.Models

{

[Table("tbl_B")]

public class B: A

{ }

}

Please help with the query and provide the solution.

 


Answers (1)