Skip to content

Commit 2682d60

Browse files
committed
Replace TryGetEntityName with TryGetMappedType
1 parent 7691115 commit 2682d60

File tree

8 files changed

+1120
-134
lines changed

8 files changed

+1120
-134
lines changed

src/NHibernate.DomainModel/FooComponent.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ public Int32 Count
9292
set { _count = value; }
9393
}
9494

95+
public int NotMapped { get; set; }
96+
9597
public DateTime[] ImportantDates
9698
{
9799
get { return _importantDates; }

src/NHibernate.DomainModel/Northwind/Entities/Address.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public string Fax
6161
get { return _fax; }
6262
}
6363

64+
public int NotMapped => 1;
65+
6466
public static bool operator ==(Address address1, Address address2)
6567
{
6668
if (!ReferenceEquals(address1, null) &&
@@ -114,4 +116,4 @@ public override int GetHashCode()
114116
(_fax ?? string.Empty).GetHashCode();
115117
}
116118
}
117-
}
119+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace NHibernate.DomainModel.Northwind.Entities
6+
{
7+
public interface IEntity<TId>
8+
{
9+
TId Id { get; set; }
10+
}
11+
12+
public interface IEntity : IEntity<int>
13+
{
14+
}
15+
}

src/NHibernate.DomainModel/Northwind/Entities/Product.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ public virtual float ShippingWeight
103103
set { _shippingWeight = value; }
104104
}
105105

106+
public virtual int NotMapped => 1;
107+
106108
public virtual ReadOnlyCollection<OrderLine> OrderLines
107109
{
108110
get { return new ReadOnlyCollection<OrderLine>(_orderLines); }
109111
}
110112
}
111-
}
113+
}

src/NHibernate.DomainModel/Northwind/Entities/User.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public interface IUser
2828
EnumStoredAsInt32 Enum2 { get; set; }
2929
}
3030

31-
public class User : IUser
31+
public class User : IUser, IEntity
3232
{
3333
public virtual int Id { get; set; }
3434

@@ -50,6 +50,10 @@ public class User : IUser
5050

5151
public virtual EnumStoredAsInt32 Enum2 { get; set; }
5252

53+
public virtual int NotMapped { get; set; }
54+
55+
public virtual Role NotMappedRole { get; set; }
56+
5357
public User() { }
5458

5559
public User(string name, DateTime registeredAt)

0 commit comments

Comments
 (0)