internal Attachment(Revision revision, String name, IDictionary<String, Object> metadata) { Revision = revision; Name = name; Metadata = metadata; Compressed = false; }
internal Attachment(Revision revision, string name, IDictionary<string, object> metadata ) { this.revision = revision; this.name = name; this.metadata = metadata; this.gzipped = false; }
public void Validate(Revision newRevision, ValidationContext context) { NUnit.Framework.Assert.IsNotNull(newRevision); NUnit.Framework.Assert.IsNotNull(context); NUnit.Framework.Assert.IsTrue(newRevision.GetProperties() != null || newRevision. IsDeletion()); this._enclosing.validationCalled = true; bool hoopy = newRevision.IsDeletion() || (newRevision.GetProperties().Get("towel" ) != null); Log.V(ValidationsTest.Tag, string.Format("--- Validating %s --> %b", newRevision. GetProperties(), hoopy)); if (!hoopy) { context.Reject("Where's your towel?"); } }
internal void SetRevision(Revision revision) { this.revision = revision; }
public void Validate(Revision newRevision, ValidationContext context) { { if (newRevision.GetProperty("groovy") == null) { context.Reject("uncool"); } } }
public void Validate(Revision newRevision, ValidationContext context) { }
public ImageConverter(Revision rev) { this.rev = rev; attachmentNamesCount = new Dictionary<string, int> (); }
static JsonSerializer GetSerializer(Type serType, Revision rev, Database db, IDReferenceResolver resolver, List<Type> localTypes) { if (resolver == null) { resolver = new IDReferenceResolver (); } if (localTypes == null) { localTypes = new List<Type> (); } localTypes.Add (serType); JsonSerializerSettings settings = new JsonSerializerSettings (); settings.Formatting = Formatting.Indented; settings.PreserveReferencesHandling = PreserveReferencesHandling.Objects; settings.TypeNameHandling = TypeNameHandling.Objects; settings.Converters.Add (new ImageConverter (rev)); settings.Converters.Add (new VersionConverter ()); settings.Converters.Add (new StorablesConverter (db, resolver, localTypes)); settings.Converters.Add (new LongoMatchConverter (false)); settings.ReferenceResolver = resolver; return JsonSerializer.Create (settings); }
/// <summary> /// Serializes an object into a <c>JObject</c>. /// </summary> /// <returns>A new object serialized.</returns> /// <param name="obj">The <c>IStorable</c> to serialize.</param> /// <param name="rev">The document revision to serialize.</param> /// <param name="localStorables">A list of <see cref="LongoMatch.Core.Interfaces.IStorable"/> /// types that should be serialized as local referencies instead of by document ID.</param> internal static JObject SerializeObject(IStorable obj, Revision rev, Database db, IDReferenceResolver resolver = null) { JsonSerializer serializer = GetSerializer (obj.GetType (), rev, db, resolver, GetLocalTypes (obj.GetType ())); JObject jo = JObject.FromObject (obj, serializer); jo ["DocType"] = obj.GetType ().Name; return jo; }