我正在爲我的博客構建核心引擎,並希望能夠非常輕鬆地對其進行擴展。 目前我的代碼看起來是這樣的:Linq to sql - 在派生類上定義繼承映射
[Table(Name = "dbo.ContentItem")]
[InheritanceMapping(Code = "MyNameSpace.Items.SysRoot", Type = typeof(SysRoot), IsDefault = true)]
[InheritanceMapping(Code = "MyNameSpace.Items.SysRecycleBin", Type = typeof(SysRecycleBin))]
public partial class ContentItem : ICloneable, INotifyPropertyChanging, INotifyPropertyChanged {
// some code here
}
上面的代碼是在我的核心項目,我想新pagetypes在我的博客項目通過例如添加inheritancemapping屬性上像這樣的類映射:
[InheritanceMapping(Code = "MyNamespace.Blog.Items.BlogPostContainer", Type = typeof(BlogPostConntainer))]
public partial class BlogPostContainer : ContentItem {
// some code here
}
這不起作用,所以我不知道是否有人有這個問題的解決方案?也許有可能在外部xml文件中編寫映射以獲得項目之間的繼承工作?
我已經嘗試過,但是當我使用基於xml的映射時,我的城堡windsor容器停止工作。你知道是否有可能使用基於xml映射的castle windsor? – Marcus 2009-08-04 11:06:01