using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Text; namespace Salesforce.NET.Entities { public abstract class SalesforceEntity { /// /// Instructs the serializer whether to serialize read-only entity properties /// [JsonIgnore] public bool SerializeReadOnlyProperties { get; set; } = true; /// /// The unique ID of the record /// [JsonProperty("id")] public string RecordId { get; set; } /// /// Used to correlate a record insert to a batch /// [QueryIgnore] public int TransactionId { get; set; } [QueryIgnore] public RecordAttributes Attributes { get; set; } public bool IsDeleted { get; set; } public string OwnerId { get; set; } public string CreatedById { get; set; } public DateTime CreatedDate { get; set; } public string LastModifiedById { get; set; } public DateTime LastModifiedDate { get; set; } public bool ShouldSerializeTransactionId() => SerializeReadOnlyProperties; public bool ShouldSerializeAttributes() => SerializeReadOnlyProperties; public bool ShouldSerializeId() => SerializeReadOnlyProperties; public bool ShouldSerializeIsDeleted() => SerializeReadOnlyProperties; public bool ShouldSerializeOwnerId() => SerializeReadOnlyProperties; public bool ShouldSerializeCreatedById() => SerializeReadOnlyProperties; public bool ShouldSerializeCreatedDate() => SerializeReadOnlyProperties; public bool ShouldSerializeLastModifiedById() => SerializeReadOnlyProperties; public bool ShouldSerializeLastModifiedDate() => SerializeReadOnlyProperties; public class RecordAttributes { public string Type { get; set; } public string Url { get; set; } } } }