Esempio n. 1
0
 public DuplicateSlugInfo(
     SlugReservationKey key,
     HashSet <EntityIdentifier> entityIdentifiers)
 {
     Key = key;
     EntityIdentifiers = entityIdentifiers;
 }
        private static DuplicateSlugInfo ToSlugReservationKeyInfo(BsonDocument document)
        {
            var culture    = document["_id"]["culture"].AsString;
            var entityType = document["_id"]["entityType"].AsString;
            var entityCode = document["_id"]["entityCode"].IsBsonNull ? null : document["_id"]["entityCode"].AsString;
            var slug       = document["_id"]["slug"].IsBsonNull ? null : document["_id"]["slug"].AsString;

            var key = new SlugReservationKey(
                slug,
                culture,
                entityType,
                entityCode);

            var identifiers = document["identifiers"]
                              .AsBsonArray
                              .Select(d => ToEntityIdentifier(d.AsBsonDocument))
                              .ToHashSet();

            return(new DuplicateSlugInfo(key, identifiers));
        }