とすれば
public abstract class AbstractOrder
{
//some properties...
}
public class AnonymousOrder:AbstractOrder
{
//some properties...
}
public class PartnerOrder:AbstractOrder
{
//some properties...
}
public AbstractOrder FindOrderByConfirmationNumber(string confirmationNumber)
{
ICriteria criteria =
Session.CreateCriteria(typeof(AbstractOrder))
.SetMaxResults(10)
.AddOrder(Order.Desc("PurchasedDate"))
.Add(Restrictions.Eq("ConfirmationNumber", confirmationNumber));
var l = criteria.List<AbstractOrder>();
AbstractOrder ao = l[0] as AbstractOrder;
return ao as AbstractOrder;
}
誰かが理由を説明してもらえますか
PartnerOrder order = repo.FindOrderByConfirmationNumber(confirmationNumber)
AnonymousOrder のタイプを返し、PartnerOrder のタイプを返すようにするにはどうすればよいですか?