1

Entity Framework, RIA Services 및 MVVM-Light 툴킷을 사용하여 Silverlight 4 응용 프로그램을 만듭니다. > * 자료 RIA 서비스로 삽입/업데이트 구성 속성

  • 작업 1 - -> * 작업 계획
  • 업무 계획 1 -> * WorkplanItems
  • 자원 1 1

    • 작업 : 다음과 같은 구조를 포함하는 복잡한 객체 그래프와 응용 프로그램 거래 -> * 할당
    • WorkplanItems 1 -> * 할당
    내가 (속성/지침을 포함하여) 작업을로드 할 수 있도록하고 싶습니다

    이 작품 벌금. 특정 작업의 루트에서 전체 그래프를로드합니다. 내가 다시 변경 사항을 제출 때, 나는 오류를 얻을

    Entity for operation '0' has multiple parents 
    

    그것은 내 메타 데이터의 구성 속성이 나에게 완전한 그래프로이 제출 한 후 업데이트를 처리 할 수 ​​있도록해야한다 무엇이라고 this post에서 나의 이해하고있다 내 실버 라이트 애플리케이션에서 한 번의 왕복으로 서버의 모든 개체를 제대로 볼 수 있습니다. 내 목표는 각 변경 사항에 변경 사항을 제출하지 않고 사용자가 작업을 여러 번 변경하고 관련 부분을 작성한 다음 제출하거나 변경 사항을 취소 할 수 있도록하는 것입니다.

    내가 간과하고있는 문제점을 알고 계시다면 알려 주시기 바랍니다. 다음은 설정 한대로 메타 데이터입니다.

    // The MetadataTypeAttribute identifies AssignmentMetadata as the class 
    // that carries additional metadata for the Assignment class. 
    [MetadataTypeAttribute(typeof(Assignment.AssignmentMetadata))] 
    public partial class Assignment 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the Assignment class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class AssignmentMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private AssignmentMetadata() 
         { 
         } 
    
         public decimal CostBudgeted { get; set; } 
    
         public decimal CostRemaining { get; set; } 
    
         public decimal HoursBudgeted { get; set; } 
    
         public decimal HoursRemaining { get; set; } 
    
         public bool IsComplete { get; set; } 
    
         public int ItemID { get; set; } 
    
         public Job Job { get; set; } 
    
         public int JobID { get; set; } 
    
         public Resource Resource { get; set; } 
    
         public int ResourceID { get; set; } 
    
         public Workplan Workplan { get; set; } 
    
         public int WorkplanID { get; set; } 
    
         public WorkplanItem WorkplanItem { get; set; } 
        } 
    } 
    
    // The MetadataTypeAttribute identifies JobMetadata as the class 
    // that carries additional metadata for the Job class. 
    [MetadataTypeAttribute(typeof(Job.JobMetadata))] 
    public partial class Job 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the Job class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class JobMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private JobMetadata() 
         { 
         } 
    
         [Display(AutoGenerateField = false)] 
         [Include] 
         [Composition] 
         public EntityCollection<Assignment> Assignments { get; set; } 
    
         [Display(Name="Client Job", Order=2, Description="Is this a client job?")] 
         [DefaultValue(true)] 
         public bool IsRealJob { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         [Include] 
         public JobDetail JobDetail { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         public int JoblID { get; set; } 
    
         [Display(Name="Job Title", Order=1, Description="What should this job be called?")] 
         public string Title { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         [Include] 
         [Composition] 
         public EntityCollection<WorkplanItem> WorkplanItems { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         [Include] 
         [Composition] 
         public EntityCollection<Workplan> Workplans { get; set; } 
    
    
         [Display(AutoGenerateField = false)] 
         [Include] 
         [Composition] 
         public EntityCollection<Resource> Resources { get; set; } 
        } 
    } 
    
    // The MetadataTypeAttribute identifies JobDetailMetadata as the class 
    // that carries additional metadata for the JobDetail class. 
    [MetadataTypeAttribute(typeof(JobDetail.JobDetailMetadata))] 
    public partial class JobDetail 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the JobDetail class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class JobDetailMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private JobDetailMetadata() 
         { 
         } 
    
         [Display(Name="Client", Order=1,Description="Name of the Client")] 
         public string Client { get; set; } 
    
         [Display(Name = "Client Fee", Order = 5, Description = "Client Fee from Engagement Letter")] 
         [DisplayFormat(DataFormatString="C",NullDisplayText="<Not Set>",ApplyFormatInEditMode=true)] 
         public Nullable<decimal> ClientFee { get; set; } 
    
         [Display(AutoGenerateField=false)] 
         public int ClientIndex { get; set; } 
    
         [Display(AutoGenerateField = true)] 
         public string EFOLDERID { get; set; } 
    
         [Display(Name = "Engagement Name", Order = 4, Description = "Friendly name of the Engagement")] 
         public string Engagement { get; set; } 
    
         [Display(Name = "Eng Type", Order = 3, Description = "Type of Work being done")] 
         public string EngagementType { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         public Job Job { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         public int JobID { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         public int PEJobID { get; set; } 
    
         [Display(Name = "Service", Order = 2, Description = "Service Type")] 
         public string Service { get; set; } 
    
         [Display(Name = "Timing of the Work", Order = 6, Description = "When will this work occur?")] 
         public string Timing { get; set; } 
        } 
    } 
    
    // The MetadataTypeAttribute identifies PendingTimesheetMetadata as the class 
    // that carries additional metadata for the PendingTimesheet class. 
    [MetadataTypeAttribute(typeof(PendingTimesheet.PendingTimesheetMetadata))] 
    public partial class PendingTimesheet 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the PendingTimesheet class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class PendingTimesheetMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private PendingTimesheetMetadata() 
         { 
         } 
    
         public decimal PendingHours { get; set; } 
    
         public string UserName { get; set; } 
    
         public DateTime WorkDate { get; set; } 
    
         [Include] 
         public Workplan Workplan { get; set; } 
    
         public int WorkplanID { get; set; } 
        } 
    } 
    
    // The MetadataTypeAttribute identifies ResourceMetadata as the class 
    // that carries additional metadata for the Resource class. 
    [MetadataTypeAttribute(typeof(Resource.ResourceMetadata))] 
    public partial class Resource 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the Resource class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class ResourceMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private ResourceMetadata() 
         { 
         } 
    
         [Include] 
         [Composition] 
         public EntityCollection<Assignment> Assignments { get; set; } 
    
         [Include] 
         public Job Job { get; set; } 
    
         public int JobID { get; set; } 
    
         public decimal Rate { get; set; } 
    
         public int ResourceID { get; set; } 
    
         public string Title { get; set; } 
    
         public string UserName { get; set; } 
        } 
    } 
    
    // The MetadataTypeAttribute identifies WorkplanMetadata as the class 
    // that carries additional metadata for the Workplan class. 
    [MetadataTypeAttribute(typeof(Workplan.WorkplanMetadata))] 
    public partial class Workplan 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the Workplan class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class WorkplanMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private WorkplanMetadata() 
         { 
         } 
    
         [Include] 
         [Composition] 
         public EntityCollection<Assignment> Assignments { get; set; } 
    
         public string Description { get; set; } 
    
         [Include] 
         public Job Job { get; set; } 
    
         public int JobID { get; set; } 
    
         public EntityCollection<PendingTimesheet> PendingTimesheets { get; set; } 
    
         public Nullable<int> PETaskID { get; set; } 
    
         public decimal TtlCost { get; set; } 
    
         public decimal TtlHours { get; set; } 
    
         public DateTime WorkEnd { get; set; } 
    
         public int WorkplanID { get; set; } 
    
         [Include] 
         [Composition] 
         public EntityCollection<WorkplanItem> WorkplanItems { get; set; } 
    
         public DateTime WorkStart { get; set; } 
        } 
    } 
    
    // The MetadataTypeAttribute identifies WorkplanItemMetadata as the class 
    // that carries additional metadata for the WorkplanItem class. 
    [MetadataTypeAttribute(typeof(WorkplanItem.WorkplanItemMetadata))] 
    public partial class WorkplanItem 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the WorkplanItem class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class WorkplanItemMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private WorkplanItemMetadata() 
         { 
         } 
    
         [Include] 
         [Composition] 
         public EntityCollection<Assignment> Assignments { get; set; } 
    
         public string Description { get; set; } 
    
         public int ItemID { get; set; } 
    
         [Include] 
         public Job Job { get; set; } 
    
         public int JobID { get; set; } 
    
         public string Notes { get; set; } 
    
         public short Ordinal { get; set; } 
    
         [Include] 
         public Workplan Workplan { get; set; } 
    
         public int WorkplanID { get; set; } 
        } 
    } 
    
  • 답변

    2

    문제점을 파악했습니다.

    1. 개체 그래프의 루트에만 [Composition] 및 [Include] 특성을 적용하십시오.이 기능은 실제로 매우 강력합니다.
    2. Composition의 루트 객체가 제출되어 업데이트 프로세스가 시작됩니다.
    3. 루트 개체의 EntityState가 실제로 업데이트를 나타내지 않을 수도 있습니다 (필자의 경우).
    4. 그래프를 다시 붙이면 모든 객체가 연결되고 상태가 동일한 값으로 설정됩니다 (삽입 됨, 업데이트 됨, 삭제됨 등)
    5. 그래프가 다시 첨부 된 후에는 엔티티가 제출 된 ChangeSet에 따라 변경됩니다.

    내가 아직 완전히 이해하지 못하는 부분이 더 많을 수 있습니다. 그러나 이것은 내 환경에서 작동합니다. 이 작업을 수행하는 더 좋은 방법을 찾고 싶습니다. 그러나 일반적인 연결 방법을 적용하려고 할 때 다른 문제가있는 것 같습니다. 여기

    내가 내 업데이트 방법에 대한 때우기 것입니다 :

    public void UpdateJob(Job currentJob) 
        { 
         //this.ObjectContext.Jobs.AttachAsModified(currentJob, this.ChangeSet.GetOriginal(currentJob)); 
    
         // compositional update process 
         foreach (Assignment a in this.ChangeSet.GetAssociatedChanges(currentJob, j => j.Assignments)) 
         { 
          ChangeOperation op = this.ChangeSet.GetChangeOperation(a); 
          switch (op) 
          { 
           case ChangeOperation.Insert: 
            InsertAssignment(a); 
            break; 
           case ChangeOperation.Update: 
            UpdateAssignment(a); 
            break; 
           case ChangeOperation.Delete: 
            DeleteAssignment(a); 
            break; 
           case ChangeOperation.None: 
            if (a.EntityState == EntityState.Detached) 
             this.ObjectContext.Assignments.Attach(a); 
            System.Data.Objects.ObjectStateEntry ose; 
            if (this.ObjectContext.ObjectStateManager.TryGetObjectStateEntry(a.EntityKey, out ose)) 
             this.ObjectContext.ObjectStateManager.ChangeObjectState(a, EntityState.Unchanged); 
            break; 
          } 
         } 
    
         foreach (WorkplanItem wpi in this.ChangeSet.GetAssociatedChanges(currentJob, j => j.WorkplanItems)) 
         { 
          ChangeOperation op = this.ChangeSet.GetChangeOperation(wpi); 
          switch (op) 
          { 
           case ChangeOperation.Insert: 
            InsertWorkplanItem(wpi); 
            break; 
           case ChangeOperation.Update: 
            UpdateWorkplanItem(wpi); 
            break; 
           case ChangeOperation.Delete: 
            DeleteWorkplanItem(wpi); 
            break; 
           case ChangeOperation.None: 
            if (wpi.EntityState == EntityState.Detached) 
             this.ObjectContext.WorkplanItems.Attach(wpi); 
            System.Data.Objects.ObjectStateEntry ose; 
            if (this.ObjectContext.ObjectStateManager.TryGetObjectStateEntry(wpi.EntityKey, out ose)) 
             this.ObjectContext.ObjectStateManager.ChangeObjectState(wpi, EntityState.Unchanged); 
            break; 
          } 
         } 
    
         foreach (Workplan wp in this.ChangeSet.GetAssociatedChanges(currentJob, j => j.Workplans)) 
         { 
          ChangeOperation op = this.ChangeSet.GetChangeOperation(wp); 
          switch (op) 
          { 
           case ChangeOperation.Insert: 
            InsertWorkplan(wp); 
            break; 
           case ChangeOperation.Update: 
            UpdateWorkplan(wp); 
            break; 
           case ChangeOperation.Delete: 
            DeleteWorkplan(wp); 
            break; 
           case ChangeOperation.None: 
            if (wp.EntityState == EntityState.Detached) 
             this.ObjectContext.Workplans.Attach(wp); 
            System.Data.Objects.ObjectStateEntry ose; 
            if (this.ObjectContext.ObjectStateManager.TryGetObjectStateEntry(wp.EntityKey, out ose)) 
             this.ObjectContext.ObjectStateManager.ChangeObjectState(wp, EntityState.Unchanged); 
            break; 
          } 
         } 
    
         foreach (Resource res in this.ChangeSet.GetAssociatedChanges(currentJob, j => j.Resources)) 
         { 
          ChangeOperation op = this.ChangeSet.GetChangeOperation(res); 
          switch (op) 
          { 
           case ChangeOperation.Insert: 
            InsertResource(res); 
            break; 
           case ChangeOperation.Update: 
            UpdateResource(res); 
            break; 
           case ChangeOperation.Delete: 
            DeleteResource(res); 
            break; 
           case ChangeOperation.None: 
            if (res.EntityState == EntityState.Detached) 
             this.ObjectContext.Resources.Attach(res); 
            System.Data.Objects.ObjectStateEntry ose; 
            if (this.ObjectContext.ObjectStateManager.TryGetObjectStateEntry(res.EntityKey, out ose)) 
             this.ObjectContext.ObjectStateManager.ChangeObjectState(res, EntityState.Unchanged); 
            break; 
          } 
         } 
    
         ChangeOperation detailop = this.ChangeSet.GetChangeOperation(currentJob.JobDetail); 
         switch (detailop) 
         { 
          case ChangeOperation.Insert: 
           InsertJobDetail(currentJob.JobDetail); 
           break; 
          case ChangeOperation.Update: 
           UpdateJobDetail(currentJob.JobDetail); 
           break; 
          case ChangeOperation.Delete: 
           DeleteJobDetail(currentJob.JobDetail); 
           break; 
          case ChangeOperation.None: 
           System.Data.Objects.ObjectStateEntry ose; 
           if (this.ObjectContext.ObjectStateManager.TryGetObjectStateEntry(currentJob.JobDetail.EntityKey, out ose)) 
             this.ObjectContext.ObjectStateManager.ChangeObjectState(currentJob.JobDetail, EntityState.Unchanged); 
           break; 
         } 
    
         if (currentJob.EntityState == EntityState.Detached) 
          this.ObjectContext.Jobs.Attach(currentJob); 
    
         ChangeOperation jobop = this.ChangeSet.GetChangeOperation(currentJob); 
         switch (jobop) 
         { 
          case ChangeOperation.Insert: 
           InsertJob(currentJob); 
           break; 
          case ChangeOperation.Update: 
           // Since this is the compositional root, we need to make sure there really is a change 
           var origJob = this.ChangeSet.GetOriginal(currentJob); 
           if (origJob != null) 
           { 
            this.ObjectContext.Jobs.AttachAsModified(currentJob, 
             origJob); 
           } 
           else 
           { 
            this.ObjectContext.ObjectStateManager.ChangeObjectState(
             currentJob, EntityState.Unchanged); 
           } 
           break; 
          case ChangeOperation.Delete: 
           DeleteJob(currentJob); 
           break; 
          case ChangeOperation.None: 
           this.ObjectContext.ObjectStateManager.ChangeObjectState(currentJob, EntityState.Unchanged); 
           break; 
         } 
    
        } 
    

    는 또한, 여기에 내가 내 개체에 대한 메타 데이터 클래스로했습니다 변경됩니다.

    // The MetadataTypeAttribute identifies AssignmentMetadata as the class 
    // that carries additional metadata for the Assignment class. 
    [MetadataTypeAttribute(typeof(Assignment.AssignmentMetadata))] 
    public partial class Assignment 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the Assignment class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class AssignmentMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private AssignmentMetadata() 
         { 
         } 
    
         public decimal CostBudgeted { get; set; } 
    
         public decimal CostRemaining { get; set; } 
    
         public decimal HoursBudgeted { get; set; } 
    
         public decimal HoursRemaining { get; set; } 
    
         public bool IsComplete { get; set; } 
    
         public int ItemID { get; set; } 
    
         public Job Job { get; set; } 
    
         public int JobID { get; set; } 
    
         public Resource Resource { get; set; } 
    
         public int ResourceID { get; set; } 
    
         public Workplan Workplan { get; set; } 
    
         public int WorkplanID { get; set; } 
    
         public WorkplanItem WorkplanItem { get; set; } 
        } 
    } 
    
    // The MetadataTypeAttribute identifies JobMetadata as the class 
    // that carries additional metadata for the Job class. 
    [MetadataTypeAttribute(typeof(Job.JobMetadata))] 
    public partial class Job 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the Job class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class JobMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private JobMetadata() 
         { 
         } 
    
         [Display(AutoGenerateField = false)] 
         [Include] 
         [Composition] 
         public EntityCollection<Assignment> Assignments { get; set; } 
    
         [Display(Name="Client Job", Order=2, Description="Is this a client job?")] 
         [DefaultValue(true)] 
         public bool IsRealJob { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         [Include] 
         [Composition] 
         public JobDetail JobDetail { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         public int JoblID { get; set; } 
    
         [Display(Name="Job Title", Order=1, Description="What should this job be called?")] 
         public string Title { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         [Include] 
         [Composition] 
         public EntityCollection<WorkplanItem> WorkplanItems { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         [Include] 
         [Composition] 
         public EntityCollection<Workplan> Workplans { get; set; } 
    
    
         [Display(AutoGenerateField = false)] 
         [Include] 
         [Composition] 
         public EntityCollection<Resource> Resources { get; set; } 
        } 
    } 
    
    // The MetadataTypeAttribute identifies JobDetailMetadata as the class 
    // that carries additional metadata for the JobDetail class. 
    [MetadataTypeAttribute(typeof(JobDetail.JobDetailMetadata))] 
    public partial class JobDetail 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the JobDetail class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class JobDetailMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private JobDetailMetadata() 
         { 
         } 
    
         [Display(Name="Client", Order=1,Description="Name of the Client")] 
         public string Client { get; set; } 
    
         [Display(Name = "Client Fee", Order = 5, Description = "Client Fee from Engagement Letter")] 
         [DisplayFormat(DataFormatString="C",NullDisplayText="<Not Set>",ApplyFormatInEditMode=true)] 
         public Nullable<decimal> ClientFee { get; set; } 
    
         [Display(AutoGenerateField=false)] 
         public int ClientIndex { get; set; } 
    
         [Display(AutoGenerateField = true)] 
         public string EFOLDERID { get; set; } 
    
         [Display(Name = "Engagement Name", Order = 4, Description = "Friendly name of the Engagement")] 
         public string Engagement { get; set; } 
    
         [Display(Name = "Eng Type", Order = 3, Description = "Type of Work being done")] 
         public string EngagementType { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         public Job Job { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         public int JobID { get; set; } 
    
         [Display(AutoGenerateField = false)] 
         public int PEJobID { get; set; } 
    
         [Display(Name = "Service", Order = 2, Description = "Service Type")] 
         public string Service { get; set; } 
    
         [Display(Name = "Timing of the Work", Order = 6, Description = "When will this work occur?")] 
         public string Timing { get; set; } 
        } 
    } 
    
    // The MetadataTypeAttribute identifies PendingTimesheetMetadata as the class 
    // that carries additional metadata for the PendingTimesheet class. 
    [MetadataTypeAttribute(typeof(PendingTimesheet.PendingTimesheetMetadata))] 
    public partial class PendingTimesheet 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the PendingTimesheet class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class PendingTimesheetMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private PendingTimesheetMetadata() 
         { 
         } 
    
         public decimal PendingHours { get; set; } 
    
         public string UserName { get; set; } 
    
         public DateTime WorkDate { get; set; } 
    
         [Include] 
         public Workplan Workplan { get; set; } 
    
         public int WorkplanID { get; set; } 
        } 
    } 
    
    // The MetadataTypeAttribute identifies ResourceMetadata as the class 
    // that carries additional metadata for the Resource class. 
    [MetadataTypeAttribute(typeof(Resource.ResourceMetadata))] 
    public partial class Resource 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the Resource class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class ResourceMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private ResourceMetadata() 
         { 
         } 
    
         public EntityCollection<Assignment> Assignments { get; set; } 
    
         public Job Job { get; set; } 
    
         public int JobID { get; set; } 
    
         public decimal Rate { get; set; } 
    
         public int ResourceID { get; set; } 
    
         public string Title { get; set; } 
    
         public string UserName { get; set; } 
        } 
    } 
    
    // The MetadataTypeAttribute identifies WorkplanMetadata as the class 
    // that carries additional metadata for the Workplan class. 
    [MetadataTypeAttribute(typeof(Workplan.WorkplanMetadata))] 
    public partial class Workplan 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the Workplan class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class WorkplanMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private WorkplanMetadata() 
         { 
         } 
    
         public EntityCollection<Assignment> Assignments { get; set; } 
    
         public string Description { get; set; } 
    
         public Job Job { get; set; } 
    
         public int JobID { get; set; } 
    
         public EntityCollection<PendingTimesheet> PendingTimesheets { get; set; } 
    
         public Nullable<int> PETaskID { get; set; } 
    
         public decimal TtlCost { get; set; } 
    
         public decimal TtlHours { get; set; } 
    
         public DateTime WorkEnd { get; set; } 
    
         public int WorkplanID { get; set; } 
    
         public EntityCollection<WorkplanItem> WorkplanItems { get; set; } 
    
         public DateTime WorkStart { get; set; } 
        } 
    } 
    
    // The MetadataTypeAttribute identifies WorkplanItemMetadata as the class 
    // that carries additional metadata for the WorkplanItem class. 
    [MetadataTypeAttribute(typeof(WorkplanItem.WorkplanItemMetadata))] 
    public partial class WorkplanItem 
    { 
    
        // This class allows you to attach custom attributes to properties 
        // of the WorkplanItem class. 
        // 
        // For example, the following marks the Xyz property as a 
        // required property and specifies the format for valid values: 
        // [Required] 
        // [RegularExpression("[A-Z][A-Za-z0-9]*")] 
        // [StringLength(32)] 
        // public string Xyz { get; set; } 
        internal sealed class WorkplanItemMetadata 
        { 
    
         // Metadata classes are not meant to be instantiated. 
         private WorkplanItemMetadata() 
         { 
         } 
    
         public EntityCollection<Assignment> Assignments { get; set; } 
    
         public string Description { get; set; } 
    
         public int ItemID { get; set; } 
    
         public Job Job { get; set; } 
    
         public int JobID { get; set; } 
    
         public string Notes { get; set; } 
    
         public short Ordinal { get; set; } 
    
         public Workplan Workplan { get; set; } 
    
         public int WorkplanID { get; set; } 
        } 
    } 
    

    누구나 다른 팁/아이디어가있는 경우 추가하십시오. 나는 더 많은 것을 배울 때 나는 더 많은 것을 계속 게시 할 것이다.

    관련 문제