Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class Account
- {
- public Guid PKey { get; set; } = Guid.NewGuid();
- public string Owner { get; set; }
- }
- public class CheckingAccount : Account
- {
- public int Fee { get; set; }
- }
- public class SavingAccount : Account
- {
- public double InterestRate { get; set; }
- }
- using(MyContext ctx = new Context())
- {
- CheckingAccount ca = ctx.CheckingAccount.Find(pKey);
- SavingAccount sa = ctx.SavingAccount.Find(pKey);
- if(ca != null)
- {
- Console.WriteLine("It's a CheckingAccount!");
- }
- else if(sa != null)
- {
- Console.WriteLine("It's a SavingAccount!");
- }
- }
Add Comment
Please, Sign In to add comment