Esempio n. 1
0
        public void UpdateRelatedRecords(
            Context context,
            SiteSettings ss,
            bool extendedSqls,
            RdsUser rdsUser          = null,
            bool addUpdatedTimeParam = true,
            bool addUpdatorParam     = true,
            bool updateItems         = true)
        {
            var fullText   = FullText(context, ss: ss);
            var statements = new List <SqlStatement>();

            statements.Add(Rds.UpdateItems(
                               where : Rds.ItemsWhere().ReferenceId(WikiId),
                               param: Rds.ItemsParam()
                               .SiteId(SiteId)
                               .Title(Title.DisplayValue)
                               .FullText(fullText, _using: fullText != null)
                               .SearchIndexCreatedTime(DateTime.Now, _using: fullText != null),
                               addUpdatedTimeParam: addUpdatedTimeParam,
                               addUpdatorParam: addUpdatorParam,
                               _using: updateItems));
            statements.Add(Rds.UpdateSites(
                               where : Rds.SitesWhere().SiteId(SiteId),
                               param: Rds.SitesParam().Title(Title.Value)));
            if (extendedSqls)
            {
                statements.OnUpdatedExtendedSqls(SiteId, WikiId);
            }
            Rds.ExecuteNonQuery(
                context: context,
                transactional: true,
                statements: statements.ToArray());
            if (ss.Sources?.Any() == true)
            {
                ItemUtilities.UpdateTitles(
                    context: context,
                    siteId: SiteId,
                    id: WikiId);
            }
            Libraries.Search.Indexes.Create(context, ss, this);
        }
Esempio n. 2
0
        public void UpdateRelatedRecords(
            SiteSettings ss,
            RdsUser rdsUser          = null,
            bool addUpdatedTimeParam = true,
            bool addUpdatorParam     = true,
            bool updateItems         = true)
        {
            var fullText = FullText(ss);

            Rds.ExecuteNonQuery(
                rdsUser: rdsUser,
                transactional: true,
                statements: new SqlStatement[]
            {
                Rds.UpdateItems(
                    where : Rds.ItemsWhere().ReferenceId(WikiId),
                    param: Rds.ItemsParam()
                    .SiteId(SiteId)
                    .Title(Title.DisplayValue)
                    .FullText(fullText, _using: fullText != null)
                    .SearchIndexCreatedTime(DateTime.Now, _using: fullText != null),
                    addUpdatedTimeParam: addUpdatedTimeParam,
                    addUpdatorParam: addUpdatorParam,
                    _using: updateItems),
                Rds.PhysicalDeleteLinks(
                    where : Rds.LinksWhere().SourceId(WikiId)),
                InsertLinks(ss),
                Rds.UpdateSites(
                    where : Rds.SitesWhere().SiteId(SiteId),
                    param: Rds.SitesParam().Title(Title.Value))
            });
            if (ss.Sources?.Any() == true)
            {
                ItemUtilities.UpdateTitles(SiteId, WikiId);
            }
            Libraries.Search.Indexes.Create(ss, this);
        }