示例#1
0
        public static AdaptAttributeBuilder ApplyDefaultRule(this AdaptAttributeBuilder builder)
        {
            return(builder
                   .ForAllTypesInNamespace(typeof(Domain._IAssemblyMark).Assembly, "Domain.DomainModels")

                   .ExcludeTypes(type => type.IsEnum)
                   .AlterType(type => type.IsAssignableFrom(typeof(LookupBase)) == true, typeof(LookupDto))
                   .ShallowCopyForSameType(true).IgnoreNullValues(true));
        }
示例#2
0
 public static AdaptAttributeBuilder ApplyDefaultRule(this AdaptAttributeBuilder builder)
 {
     return(builder
            .ForAllTypesInNamespace(Assembly.GetExecutingAssembly(), "Sample.CodeGen.Domains")
            .ExcludeTypes(typeof(SchoolContext))
            .ExcludeTypes(type => type.IsEnum)
            .AlterType(type => type.IsEnum || Nullable.GetUnderlyingType(type)?.IsEnum == true, typeof(string))
            .ShallowCopyForSameType(true)
            .ForType <Enrollment>(cfg => cfg.Ignore(it => it.Course))
            .ForType <Student>(cfg => cfg.Ignore(it => it.Enrollments)));
 }
示例#3
0
 public static AdaptAttributeBuilder ApplyDefaultRule(this AdaptAttributeBuilder builder)
 {
     return(builder
            .ForAllTypesInNamespace(Assembly.GetAssembly(typeof(BaseEntity)), "QuizApp.DataAccess.Entities")
            .ExcludeTypes(typeof(BaseEntity), typeof(User))
            .ShallowCopyForSameType(true)
            .ForType <Subject>(cfg => cfg.Ignore(s => s.Lecturer))
            .ForType <Topic>(cfg => cfg.Ignore(t => t.Subject))
            .ForType <Question>(cfg => cfg.Ignore(q => q.Topic))
            .ForType <Answer>(cfg => cfg.Ignore(a => a.Question))
            .ForType <Attempt>(cfg => cfg.Ignore(at => at.Student)
                               .Ignore(a => a.Topic))
            .ForType <QuestionResult>(cfg => cfg.Ignore(qr => qr.Attempt)
                                      .Ignore(qr => qr.Question)));
 }
示例#4
0
 public static AdaptAttributeBuilder ApplyDefaultRule(this AdaptAttributeBuilder builder)
 {
     return(builder
            .ForAllTypesInNamespace(Assembly.GetAssembly(typeof(BaseEntity)), "DAL.Entities")
            .ExcludeTypes(typeof(BaseEntity), typeof(User))
            .ExcludeTypes(type => type.IsEnum)
            .ShallowCopyForSameType(true)
            .ForType <Consultation>(cfg => cfg.Ignore(c => c.Lecturer)
                                    .Ignore(c => c.Subject))
            .ForType <Queue>(cfg =>
     {
         cfg.Ignore(q => q.Consultation);
         cfg.Map(q => q.IssueCategory, typeof(IssueCategory));
     })
            .ForType <QueueMember>(cfg => cfg.Ignore(qm => qm.Student)
                                   .Ignore(qm => qm.Queue)));
 }