How do you use the LINQ to SQL designer to generate accessor methods for subclasses?
-
23-09-2019 - |
문제
alt text http://img16.imageshack.us/img16/8085/datacontext.jpg
Above is the LINQ to SQL designer view for my data context.
Below is the relevant code that the designer generates:
Accessor for the abstract ActivityBase class:
public System.Data.Linq.Table<ActivityBase> ActivityBases
{
get
{
return this.GetTable<ActivityBase>();
}
}
The ActivityBase class and the list of subclasses:
[Table(Name="dbo.Activities")]
[InheritanceMapping(Code="1", Type=typeof(ActivityBase), IsDefault=true)]
[InheritanceMapping(Code="2", Type=typeof(Project))]
[InheritanceMapping(Code="3", Type=typeof(ProjectActivity))]
[InheritanceMapping(Code="5", Type=typeof(Task))]
[InheritanceMapping(Code="4", Type=typeof(Activity))]
public abstract partial class ActivityBase : INotifyPropertyChanging, INotifyPropertyChanged
{
Is there a way to generate accessor methods for the subclasses as shown in the inheritance mapping above (Project, Task, etc...) without doing it manually? I added them manually but then a change in the designer overwrites any manual changes.
Am i doing this wrong? should I not be making accessors for the sub classes? filtering from ActivityBase seems worse to me.
Thanks for any help on this.
해결책
잘 협력하여 의미하는 것에 달려 있습니다.
문서 나 목록에 저장된 데이터를 공유하여 공동 작업을 원한다면 예 SharePoint는 제품입니다.
동시 편집이있는 문서 만들기를 공동 작업하려면 Office Web Apps 제품입니다..
토론의 형태로 지식을 공유함으로써 공동 작업을 원한다면 Yammer 가 제품입니다.
전자 메일을 사용하여 공동 작업을 원한다면 Outlook / Exchange는 제품입니다.
이 모든 것은 Office 365 에서 결합되어 있습니다. 그래서 아마도 최고의 Microsoft Collaboration "제품이라고 할 것입니다.".
다른 팁
I found this question answers what I wanted to know:
What is the .cs file under MyDataContext.dbml for?
since the data context is also a partial class I can use that file.