0
이없는 부모 클래스의 서브 클래스를지도 않는 슈퍼 클래스와 서브 클래스에 대한 가정 데이터. 나는 '어떻게 내 데이터베이스에 두 개의 테이블이 더 테이블
TierSettings(
Id Guid Primary Key,
SomeTierSetting NVarChar(100)
)
PricingStrategies(
Id Guid Primary Key, Foreign Key References Parent(Id),
StrategySetting1 NVarChar(100),
StrategySetting2 NVarChar(100),
StrategyType Int,
Value Float
)
:하지만, 내 응용 프로그램에서, 나는 중간 데이터가 바닥 서브 클래스에서로드되는 둘 사이 클래스 ... 내 데이터베이스에서
abstract public class TierSettings
{
public Guid id { get; set; }
public string SomeTierSetting { get; set; }
}
abstract public class PricingStrategy : TierSettings
{
public string StrategySetting1 { get; set; }
public string StrategySetting2 { get; set; }
}
public class FirstPricingStrategy : PricingStrategy
{
public PricingStrategyType Strategy { get { return PricingStrategyType.Strategy1; } }
pubic Decimal Value { get; set; }
}
public class SecondPricingStrategy : PricingStrategy
{
public PricingStrategyType Strategy { get { return PricingStrategyType.Strategy2; } }
public Decimal Value { get; set; }
}
이 난 그냥 두 테이블이 내 hbm.xml 파일에 관계를 매핑하는 데 문제가 있습니다. 개별 PricingStrategy 클래스를 확장 Tier로 매핑하면 StrategySetting 속성에 액세스 할 수 없지만 PricingStrategy 클래스는 데이터베이스에 직접 매핑되지 않습니다.
나는 그런 쿼리 할 수 있어야합니다 :
var items = from items in session.Query<TierSettings>()
select item;
foreach(var item in items)
{
Console.WriteLine(item.Value);
}
어떻게 따라 내 매핑 파일을 구성 할 수 있습니까?
덕분에, 나는 이미 보았다 싶지만, 내가 뭔가를 누락하거나 또는 계정에 그 사실을지지 않습니다 내 최상위 추상 클래스를 대략적으로 동화 한 표가 있습니다. 나는 내가 어디에 있는지, 어디로 갈 필요가있는간에 ... 점들을 연결시킬 수는 없다 ... 당신은 더 이상의 설명을 할 수 있는가? – BobTheBuilder