当前位置: 首页>>代码示例>>C#>>正文


C# SchemaBuilder.Include方法代码示例

本文整理汇总了C#中SchemaBuilder.Include方法的典型用法代码示例。如果您正苦于以下问题:C# SchemaBuilder.Include方法的具体用法?C# SchemaBuilder.Include怎么用?C# SchemaBuilder.Include使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SchemaBuilder的用法示例。


在下文中一共展示了SchemaBuilder.Include方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

        public static void Start(SchemaBuilder sb)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                // QueryManagers = queryManagers;
                sb.Schema.Initializing += () =>
                {
                    queryNamesLazy.Load();

                    queryNameToEntityLazy.Load();
                };

                sb.Include<QueryEntity>();

                sb.Schema.Synchronizing += SynchronizeQueries;
                sb.Schema.Generating += Schema_Generating;

                queryNamesLazy = sb.GlobalLazy(()=>CreateQueryNames(), new InvalidateWith(typeof(QueryEntity)));

                queryNameToEntityLazy = sb.GlobalLazy(() => 
                    EnumerableExtensions.JoinStrict(
                        Database.Query<QueryEntity>().ToList(),
                        QueryNames,
                        q => q.Key,
                        kvp => kvp.Key,
                        (q, kvp) => KVP.Create(kvp.Value, q),
                        "caching QueryEntity. Consider synchronize").ToDictionary(),
                    new InvalidateWith(typeof(QueryEntity)));
            }
        }
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:30,代码来源:QueryLogic.cs

示例2: Start

        public static void Start(SchemaBuilder sb, DynamicQueryManager dqm, HashSet<Type> registerExpression)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                sb.Include<ViewLogEntity>();

                dqm.RegisterQuery(typeof(ViewLogEntity), () =>
                    from e in Database.Query<ViewLogEntity>()
                    select new
                    {
                        Entity = e,
                        e.Id,
                        e.Target,
                        e.ViewAction,
                        e.User,
                        e.Duration,
                        e.StartDate,
                        e.EndDate,
                    });

                ExceptionLogic.DeleteLogs += ExceptionLogic_DeleteLogs;

                var exp = Signum.Utilities.ExpressionTrees.Linq.Expr((Entity entity) => entity.ViewLogs());

                foreach (var t in registerExpression)
                {
                    dqm.RegisterExpression(new ExtensionInfo(t, exp, exp.Body.Type, "ViewLogs", () => typeof(ViewLogEntity).NicePluralName()));
                }

                DynamicQueryManager.Current.QueryExecuted += Current_QueryExecuted;
                sb.Schema.Table<TypeEntity>().PreDeleteSqlSync += Type_PreDeleteSqlSync;
            }
        }
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:33,代码来源:ViewLogLogic.cs

示例3: Start

        public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                sb.Include<ExceptionEntity>();

                dqm.RegisterQuery(typeof(ExceptionEntity),()=>
                    from r in Database.Query<ExceptionEntity>()
                    select new
                    {
                        Entity = r,
                        r.Id,
                        r.CreationDate,
                        r.ExceptionType,
                        ExcepcionMessage = r.ExceptionMessage,
                        r.StackTraceHash,
                    });

                dqm.RegisterQuery(typeof(ExceptionEntity), ()=>
                     from r in Database.Query<ExceptionEntity>()
                     select new
                     {
                         Entity = r,
                         r.Id,
                         r.CreationDate,
                         r.ExceptionType,
                         ExcepcionMessage = r.ExceptionMessage,
                         r.StackTraceHash,
                     });

                DefaultEnvironment = "Default"; 
            }
        }
开发者ID:rondoo,项目名称:framework,代码行数:33,代码来源:ExceptionLogic.cs

示例4: Start

        public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                AuthLogic.AssertStarted(sb);

                sb.Include<SessionLogEntity>();

                PermissionAuthLogic.RegisterPermissions(SessionLogPermission.TrackSession);

                dqm.RegisterQuery(typeof(SessionLogEntity), () =>
                    from sl in Database.Query<SessionLogEntity>()
                    select new
                    {
                        Entity = sl,
                        sl.Id,
                        sl.User,
                        sl.SessionStart,
                        sl.SessionEnd,
                        sl.SessionTimeOut
                    });

                ExceptionLogic.DeleteLogs += ExceptionLogic_DeleteLogs;
            }
        }
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:25,代码来源:SessionLogLogic.cs

示例5: Start

        public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                sb.Include<DynamicValidationEntity>()
                    .WithSave(DynamicValidationOperation.Save)
                    .WithQuery(dqm, e => new
                    {
                        Entity = e,
                        e.Id,
                        e.Name,
                        e.EntityType,
                        e.PropertyRoute,
                        e.Eval,
                    });
                DynamicValidations = sb.GlobalLazy(() =>
                    Database.Query<DynamicValidationEntity>()
                    .Select(dv => new DynamicValidationPair { Validation = dv, PropertyRoute = dv.PropertyRoute.ToPropertyRoute() })
                    .GroupToDictionary(a => a.PropertyRoute.PropertyInfo),
                        new InvalidateWith(typeof(DynamicValidationEntity)));

                sb.Schema.Initializing += () => { initialized = true; };

                Validator.GlobalValidation += DynamicValidation;
            }
        }
开发者ID:mapacheL,项目名称:extensions,代码行数:26,代码来源:DynamicValidationLogic.cs

示例6: Start

        public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                IsStarted = true;

                AuthLogic.AssertStarted(sb);
                sb.Include<UserTicketEntity>();

                dqm.RegisterQuery(typeof(UserTicketEntity), () =>
                    from ut in Database.Query<UserTicketEntity>()
                    select new
                    {
                        Entity = ut,
                        ut.Id,
                        ut.User,
                        ut.Ticket,
                        ut.ConnectionDate,
                        ut.Device,
                    });

                dqm.RegisterExpression((UserEntity u) => u.UserTickets(), () => typeof(UserTicketEntity).NicePluralName());

                sb.Schema.EntityEvents<UserEntity>().Saving += UserTicketLogic_Saving; 
            }
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:26,代码来源:UserTicketLogic.cs

示例7: Start

        public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                sb.Include<SmtpConfigurationEntity>();

                dqm.RegisterQuery(typeof(SmtpConfigurationEntity), () =>
                    from s in Database.Query<SmtpConfigurationEntity>()
                    select new
                    {
                        Entity = s,
                        s.Id,
                        s.DeliveryMethod,
                        s.Network.Host,
                        s.Network.Username,
                        s.PickupDirectoryLocation
                    });

                SmtpConfigCache = sb.GlobalLazy(() => Database.Query<SmtpConfigurationEntity>().ToDictionary(a => a.ToLite()),
                    new InvalidateWith(typeof(SmtpConfigurationEntity)));

                new Graph<SmtpConfigurationEntity>.Execute(SmtpConfigurationOperation.Save)
                {
                    AllowsNew = true,
                    Lite = false,
                    Execute = (sc, _) => { },
                }.Register();
            }
        }
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:29,代码来源:SmtpConfigurationLogic.cs

示例8: Start

        internal static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                sb.Include<ChartScriptEntity>();

                dqm.RegisterQuery(typeof(ChartScriptEntity), () =>
                    from uq in Database.Query<ChartScriptEntity>()
                    select new
                    {
                        Entity = uq,
                        uq.Id,
                        uq.Name,
                        uq.GroupBy,
                        uq.Columns.Count,
                        uq.Icon,
                    });

                Scripts = sb.GlobalLazy(() =>
                {
                    var result = Database.Query<ChartScriptEntity>().ToDictionary(a => a.Name);
                    foreach (var e in result.Values)
                        if (e.Icon != null)
                            e.Icon.Retrieve();

                    return result;
                }, new InvalidateWith(typeof(ChartScriptEntity)));

                RegisterOperations();
            }
        }
开发者ID:mapacheL,项目名称:extensions,代码行数:31,代码来源:ChartScriptLogic.cs

示例9: Start

        public static void Start(SchemaBuilder sb, DynamicQueryManager dqm, bool excelReport)
        {
            if (excelReport)
            {
                QueryLogic.Start(sb);

                sb.Include<ExcelReportEntity>();
                dqm.RegisterQuery(typeof(ExcelReportEntity), () =>
                    from s in Database.Query<ExcelReportEntity>()
                    select new
                    {
                        Entity = s,
                        s.Id,
                        s.Query,
                        s.File.FileName,
                        s.DisplayName,
                    });

                new Graph<ExcelReportEntity>.Execute(ExcelReportOperation.Save)
                {
                    AllowsNew = true,
                    Lite = false,
                    Execute = (er, _) => { }
                }.Register();

                new Graph<ExcelReportEntity>.Delete(ExcelReportOperation.Delete)
                {
                    Lite = true,
                    Delete = (er, _) => { er.Delete(); }
                }.Register();
            }
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:32,代码来源:ExcelLogic.cs

示例10: Start

        public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                sb.Include<DynamicViewEntity>()
                    .WithUniqueIndex(a => new { a.ViewName, a.EntityType })
                    .WithSave(DynamicViewOperation.Save)
                    .WithDelete(DynamicViewOperation.Delete)
                    .WithQuery(dqm, e => new
                    {
                        Entity = e,
                        e.Id,
                        e.ViewName,
                        e.EntityType,
                    });


                new Graph<DynamicViewEntity>.Construct(DynamicViewOperation.Create)
                {
                    Construct = (_) => new DynamicViewEntity(),
                }.Register();

                new Graph<DynamicViewEntity>.ConstructFrom<DynamicViewEntity>(DynamicViewOperation.Clone)
                {
                    Construct = (e, _) => new DynamicViewEntity()
                    {
                        ViewName = "",
                        EntityType = e.EntityType,
                        ViewContent = e.ViewContent,
                    },
                }.Register();

                DynamicViews = sb.GlobalLazy(() =>
                    Database.Query<DynamicViewEntity>().GroupToDictionary(a => a.EntityType.ToType()),
                    new InvalidateWith(typeof(DynamicViewEntity)));

                sb.Include<DynamicViewSelectorEntity>()
                    .WithSave(DynamicViewSelectorOperation.Save)
                    .WithDelete(DynamicViewSelectorOperation.Delete)
                    .WithQuery(dqm, e => new
                    {
                        Entity = e,
                        e.Id,
                        e.EntityType,
                    });
            }
        }
开发者ID:mapacheL,项目名称:extensions,代码行数:47,代码来源:DynamicViewLogic.cs

示例11: Start

        public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                FileTypeLogic.Start(sb, dqm);

                sb.Include<FilePathEntity>();

                sb.Schema.EntityEvents<FilePathEntity>().Retrieved += FilePathLogic_Retrieved;
                sb.Schema.EntityEvents<FilePathEntity>().PreSaving += FilePath_PreSaving;
                sb.Schema.EntityEvents<FilePathEntity>().PreUnsafeDelete += new PreUnsafeDeleteHandler<FilePathEntity>(FilePathLogic_PreUnsafeDelete);

                dqm.RegisterQuery(typeof(FilePathEntity), () =>
                    from p in Database.Query<FilePathEntity>()
                    select new
                    {
                        Entity = p,
                        p.Id,
                        p.FileName,
                        p.FileType,
                        p.Sufix
                    });

                new Graph<FilePathEntity>.Execute(FilePathOperation.Save)
                {
                    AllowsNew = true,
                    Lite = false,
                    Execute = (fp, _) =>
                    {
                        if (!fp.IsNew)
                        {

                            var ofp = fp.ToLite().Retrieve();


                            if (fp.FileName != ofp.FileName || fp.Sufix != ofp.Sufix || fp.FullPhysicalPath != ofp.FullPhysicalPath)
                            {
                                using (Transaction tr = new Transaction())
                                {
                                    var preSufix = ofp.Sufix.Substring(0, ofp.Sufix.Length - ofp.FileName.Length);
                                    fp.Sufix = Path.Combine(preSufix, fp.FileName);
                                    fp.Save();
                                    System.IO.File.Move(ofp.FullPhysicalPath, fp.FullPhysicalPath);
                                    tr.Commit();
                                }
                            }
                        }
                    }
                }.Register();

                OperationLogic.SetProtectedSave<FilePathEntity>(false);

                sb.AddUniqueIndex<FilePathEntity>(f => new { f.Sufix, f.FileType }); //With mixins, add AttachToUniqueIndexes to field

                dqm.RegisterExpression((FilePathEntity fp) => fp.WebImage(), () => typeof(WebImage).NiceName(), "Image");
                dqm.RegisterExpression((FilePathEntity fp) => fp.WebDownload(), () => typeof(WebDownload).NiceName(), "Download");

            }
        }
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:59,代码来源:FilePathLogic.cs

示例12: Start

        public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                sb.Include<PasswordExpiresIntervalEntity>();

                dqm.RegisterQuery(typeof(PasswordExpiresIntervalEntity), ()=>
                    from e in Database.Query<PasswordExpiresIntervalEntity>()
                     select new
                     {
                         Entity = e,
                         e.Id,
                         e.Enabled,
                         e.Days,
                         e.DaysWarning
                     });

                new Graph<PasswordExpiresIntervalEntity>.Execute(PasswordExpiresIntervalOperation.Save)
                {
                    AllowsNew = true,
                    Lite = false,
                    Execute = (pei, _) => { },
                }.Register();

                AuthLogic.UserLogingIn += (u =>
                {
                    if (u.PasswordNeverExpires)
                        return;

                    var ivp = Database.Query<PasswordExpiresIntervalEntity>().Where(p => p.Enabled).FirstOrDefault();
                    if (ivp == null)
                        return;
                    
                    if (TimeZoneManager.Now > u.PasswordSetDate.AddDays((double)ivp.Days))
                        throw new PasswordExpiredException(AuthMessage.ExpiredPassword.NiceToString());
                });

                AuthLogic.LoginMessage += (() =>
                {
                    UserEntity u = UserEntity.Current;

                    if (u.PasswordNeverExpires)
                        return null;

                    PasswordExpiresIntervalEntity ivp = null;
                    using (AuthLogic.Disable())
                        ivp = Database.Query<PasswordExpiresIntervalEntity>().Where(p => p.Enabled).FirstOrDefault();
                    
                    if (ivp == null)
                        return null;

                    if (TimeZoneManager.Now > u.PasswordSetDate.AddDays((double)ivp.Days).AddDays((double)-ivp.DaysWarning))
                        return AuthMessage.YourPasswordIsNearExpiration.NiceToString();

                    return null;
                });
            }
        }
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:58,代码来源:PasswordExpiresLogic.cs

示例13: Start

        public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                sb.Include<EmailPackageEntity>();

                dqm.RegisterExpression((EmailPackageEntity ep) => ep.Messages(), () => EmailMessageMessage.Messages.NiceToString());
                dqm.RegisterExpression((EmailPackageEntity ep) => ep.RemainingMessages(), () => EmailMessageMessage.RemainingMessages.NiceToString());
                dqm.RegisterExpression((EmailPackageEntity ep) => ep.ExceptionMessages(), () => EmailMessageMessage.ExceptionMessages.NiceToString());

                ProcessLogic.AssertStarted(sb);
                ProcessLogic.Register(EmailMessageProcess.CreateEmailsSendAsync, new CreateEmailsSendAsyncProcessAlgorithm());
                ProcessLogic.Register(EmailMessageProcess.SendEmails, new SendEmailProcessAlgorithm());

                new Graph<ProcessEntity>.ConstructFromMany<EmailMessageEntity>(EmailMessageOperation.ReSendEmails)
                {
                    Construct = (messages, args) =>
                    {
                        EmailPackageEntity emailPackage = new EmailPackageEntity()
                        {
                            Name = args.TryGetArgC<string>()
                        }.Save();

                        foreach (var m in messages.Select(m => m.RetrieveAndForget()))
                        {
                            new EmailMessageEntity()
                            {
                                Package = emailPackage.ToLite(),
                                From = m.From,
                                Recipients = m.Recipients.ToMList(),
                                Target = m.Target,
                                Body = m.Body,
                                IsBodyHtml = m.IsBodyHtml,
                                Subject = m.Subject,
                                Template = m.Template,
                                EditableMessage = m.EditableMessage,
                                State = EmailMessageState.RecruitedForSending
                            }.Save();
                        }

                        return ProcessLogic.Create(EmailMessageProcess.SendEmails, emailPackage);
                    }
                }.Register();

                dqm.RegisterQuery(typeof(EmailPackageEntity), () =>
                    from e in Database.Query<EmailPackageEntity>()
                    select new
                    {
                        Entity = e,
                        e.Id,
                        e.Name,
                    });
            }
        }
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:54,代码来源:EmailPackageLogic.cs

示例14: Start

        public static void Start(SchemaBuilder sb)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                sb.Include<PropertyRouteEntity>();

                sb.AddUniqueIndex<PropertyRouteEntity>(p => new { p.Path, p.RootType }); 

                sb.Schema.Synchronizing += SyncronizeProperties;
            }
        }
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:11,代码来源:PropertyRouteLogic.cs

示例15: Start

        public static void Start(SchemaBuilder sb, DynamicQueryManager dqm)
        {
            sb.Include<ExcelAttachmentEntity>();
            dqm.RegisterQuery(typeof(ExcelAttachmentEntity), () =>
                from s in Database.Query<ExcelAttachmentEntity>()
                select new
                {
                    Entity = s,
                    s.Id,
                    s.FileName,
                    s.UserQuery,
                    s.Related,
                });


            EmailTemplateLogic.FillAttachmentTokens.Register((ExcelAttachmentEntity uqe, EmailTemplateLogic.FillAttachmentTokenContext ctx) =>
            {
                if (uqe.FileName != null)
                    EmailTemplateParser.Parse(uqe.FileName, ctx.QueryDescription, ctx.ModelType).FillQueryTokens(ctx.QueryTokens);

                if (uqe.Title != null)
                    EmailTemplateParser.Parse(uqe.Title, ctx.QueryDescription, ctx.ModelType).FillQueryTokens(ctx.QueryTokens);
            });

            Validator.PropertyValidator((ExcelAttachmentEntity e) => e.FileName).StaticPropertyValidation = ExcelAttachmentFileName_StaticPropertyValidation;
            Validator.PropertyValidator((ExcelAttachmentEntity e) => e.Title).StaticPropertyValidation = ExcelAttachmentTitle_StaticPropertyValidation;

            EmailTemplateLogic.GenerateAttachment.Register((ExcelAttachmentEntity uqe, EmailTemplateLogic.GenerateAttachmentContext ctx) =>
            {
                var finalEntity = uqe.Related?.Retrieve() ?? (Entity)ctx.Entity;

                using (finalEntity == null ? null : CurrentEntityConverter.SetCurrentEntity(finalEntity))
                using (CultureInfoUtils.ChangeBothCultures(ctx.Culture))
                {
                    QueryRequest request = UserQueryLogic.ToQueryRequest(uqe.UserQuery.Retrieve());

                    var title = GetTemplateString(uqe.Title, ref uqe.TitleNode, ctx);
                    var fileName = GetTemplateString(uqe.FileName, ref uqe.FileNameNode, ctx);

                    var bytes = ExcelLogic.ExecutePlainExcel(request, title);

                    return new List<EmailAttachmentEntity>
                        {
                            new EmailAttachmentEntity
                            {
                                File = Files.EmbeddedFilePathLogic.SaveFile(new Entities.Files.EmbeddedFilePathEntity(EmailFileType.Attachment, fileName, bytes)),
                                Type = EmailAttachmentType.Attachment,
                            }
                        };
                }
            });
        }
开发者ID:mapacheL,项目名称:extensions,代码行数:52,代码来源:ExcelAttachmentLogic.cs


注:本文中的SchemaBuilder.Include方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。