private static void AddMetaData(BsonDocument document, BundleEntry entry) { document[Field.VERSIONID] = entry.Links.SelfLink.ToString(); document[Field.ENTRYTYPE] = entry.TypeName(); document[Field.COLLECTION] = entry.GetResourceTypeName(); document[Field.VERSIONDATE] = GetVersionDate(entry) ?? DateTime.UtcNow; }
public static bool HasValidLocalKey(BundleEntry entry) { string type = entry.GetResourceTypeName(); Uri id = entry.Id; return(Key.IsValidLocalKey(id, type)); }
private static bool requiresVersionAwareUpdate(BundleEntry entry) { // todo: question: Should this not be implemented somewhere else? (metadata?) /mh // answer: move to Config file. string collection = entry.GetResourceTypeName(); return(collection == "Organization"); }
private Uri internalizeKey(BundleEntry entry) { Uri key = entry.Id; if (Key.IsCID(key)) { string type = entry.GetResourceTypeName(); string _id = generator.NextKey(type); return(ResourceIdentity.Build(type, _id).OperationPath); } else if (Key.IsHttpScheme(key)) { AssertKeyAllowed(key); return(key.GetOperationpath()); } else { throw new SparkException((HttpStatusCode)422, "Id is not a http location or a CID: " + key.ToString()); } }