public AddressCandidate(AddressType type, long address, int port) { this.type = new AddressType?(type); this.address = new long?(address); this.port = new int?(port); this.extension = null; }
public DataEntityDTO CreatePupil( Guid ID, string legalForename, string legalSurname, Date dateOfBirth, Guid genderID, Guid schoolID, int referenceID, ExtensionDataObject extensionData) { DataEntityDTO.SimplePropertyDTOGuid IDProperty = new DataEntityDTO.SimplePropertyDTOGuid { Value = ID }; DataEntityDTO.SimplePropertyDTOString legalForenameProperty = new DataEntityDTO.SimplePropertyDTOString { Value = legalForename }; DataEntityDTO.SimplePropertyDTOString legalSurnameProperty = new DataEntityDTO.SimplePropertyDTOString { Value = legalSurname }; DataEntityDTO.SimplePropertyDTODate dateOfBirthProperty = new DataEntityDTO.SimplePropertyDTODate { Value = dateOfBirth }; DataEntityDTO.ReferencePropertyDTO schoolProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = schoolID }; DataEntityDTO.ReferencePropertyDTO genderProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = genderID }; DataEntityDTO entity = new DataEntityDTO { EntityName = "Learner", Values = new Dictionary<string, DataEntityDTO.SimplePropertyDTO> { {"ID", IDProperty}, {"LegalForename", legalForenameProperty}, {"LegalSurname", legalSurnameProperty}, {"DateOfBirth", dateOfBirthProperty}, {"Gender", genderProperty}, {"School", schoolProperty} } }; return PupilDetails.EntitySettings(entity, ID, referenceID, extensionData); }
void ReadMembers(ClassDataContract classContract, ExtensionDataObject extensionData) { int memberCount = classContract.MemberNames.Length; context.IncrementItemCount(memberCount); int memberIndex = -1; // JSON intrinsic part. BitFlagsGenerator expectedElements = new BitFlagsGenerator(memberCount); byte [] requiredElements = new byte [expectedElements.GetLocalCount()]; SetRequiredElements(classContract, requiredElements); SetExpectedElements(expectedElements, 0 /*startIndex*/); while (XmlObjectSerializerReadContext.MoveToNextElement(xmlReader)) { int idx; // used as in "switch (idx)" in the original source. idx = context.GetJsonMemberIndex(xmlReader, memberNames, memberIndex, extensionData); if (memberCount > 0) { ReadMembers(idx, classContract, expectedElements, ref memberIndex); } } if (!CheckRequiredElements(expectedElements, requiredElements)) { XmlObjectSerializerReadContextComplexJson.ThrowMissingRequiredMembers(objectLocal, memberNames, expectedElements.LoadArray(), requiredElements); } }
/// <summary> /// Converts extension data from a deserialised JSON object into usable data. /// </summary> /// <param name="data">An ExtensionDataObject containing the extension data.</param> /// <returns>A JsonExtensionDataItemCollection containing the results.</returns> internal static JsonExtensionDataItemCollection ConvertExtensionData(ExtensionDataObject data) { JsonExtensionDataItemCollection ReturnValue; // Defaults ReturnValue = new JsonExtensionDataItemCollection(); ReturnValue = UnpackExtensionDataMembers(data); return(ReturnValue); }
/// <summary> /// Initializes a new instance of the <see cref="SerializableEntity"/> class. /// </summary> /// <param name="entity">The entity.</param> public SerializableEntity(Entity entity) { Attributes = new SerializableAttributeCollection(entity.Attributes); EntityState = entity.EntityState; ExtensionData = entity.ExtensionData; FormattedValues = new SerializableFormattedValueCollection(entity.FormattedValues); Id = entity.Id; KeyAttributes = new SerializableKeyAttributeCollection(entity.KeyAttributes); LogicalName = entity.LogicalName; RelatedEntities = new SerializableRelatedEntityCollection(entity.RelatedEntities); RowVersion = entity.RowVersion; }
/// <summary> /// Initializes a new instance of the <see cref="SerializableEntityCollection"/> class. /// </summary> /// <param name="entities">The entities.</param> public SerializableEntityCollection(EntityCollection entities) : this() { foreach (var entity in entities.Entities) { Entities.Add(new SerializableEntity(entity)); } EntityName = entities.EntityName; ExtensionData = entities.ExtensionData; MinActiveRowVersion = entities.MinActiveRowVersion; MoreRecords = entities.MoreRecords; PagingCookie = entities.PagingCookie; TotalRecordCount = entities.TotalRecordCount; TotalRecordCountLimitExceeded = entities.TotalRecordCountLimitExceeded; }
public static DataEntityDTO NewEntitySettings(Guid ID, int reference, ExtensionDataObject extensionData, string entityName) { DataEntityDTO entity = new DataEntityDTO { ReferenceID = reference, ID = ID, EntityName = entityName, DataModelContextID = "sims8_team1", DataModelType = new DataEntityDTO.DataModelTypeDTO { SchemaName = "dbo", DataModelPurpose = "BusinessDataModel", ExtensionData = extensionData }, ExtensionData = extensionData, Values = new Dictionary <string, DataEntityDTO.SimplePropertyDTO>() }; return(entity); }
public static ExtensionDataObject GetExtensionDataObject() { var obj = new ExtensionDataObject() { FirstName = "John", LastName = "Doe", SomeBooleanValue = true, SomeNumber = 100, Json = "{\"FirstName\":\"John\",\"LastName\":\"Doe\",\"SomeNumber\":100,\"SomeBooleanValue\":true,\"key1\":\"value1\",\"key2\":\"value2\",\"key3\":\"value3\"}" }; Dictionary <string, object> dict = new Dictionary <string, object>(); dict.Add("key1", "value1"); dict.Add("key2", "value2"); dict.Add("key3", "value3"); obj.ExtraData = dict; return(obj); }
public DataEntityDTO CreateStandardPupilLogNote( Guid ID, string title, string noteText, Guid learnerID, Guid categoryID, Guid userID, bool pinned, int collectionCount, int referenceID, ExtensionDataObject extensionData) { DataEntityDTO.SimplePropertyDTOGuid IDProperty = new DataEntityDTO.SimplePropertyDTOGuid { Value = ID }; DataEntityDTO.SimplePropertyDTOString titleProperty = new DataEntityDTO.SimplePropertyDTOString { Value = title }; DataEntityDTO.SimplePropertyDTOString noteTextProperty = new DataEntityDTO.SimplePropertyDTOString { Value = noteText }; DataEntityDTO.SimplePropertyDTOBool pinnedProperty = new DataEntityDTO.SimplePropertyDTOBool { Value = pinned }; DataEntityDTO.SimplePropertyDTODateTime createdOnProperty = new DataEntityDTO.SimplePropertyDTODateTime { Value = DateTime.Now }; DataEntityDTO.SimplePropertyDTOGuid createdByProperty = new DataEntityDTO.SimplePropertyDTOGuid { Value = userID }; DataEntityDTO.ReferencePropertyDTO learnerProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = learnerID }; DataEntityDTO.ReferencePropertyDTO categoryProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = categoryID }; DataEntityDTO entity = new DataEntityDTO { EntityName = "PupilLogNoteStandard", Values = new Dictionary<string, DataEntityDTO.SimplePropertyDTO> { {"ID", IDProperty}, {"Title", titleProperty}, {"NoteText", noteTextProperty}, {"Pinned", pinnedProperty}, {"CreatedOn", createdOnProperty}, {"CreatedByUserId", createdByProperty}, {"Learner", learnerProperty}, {"PupilLogNoteCategory", categoryProperty} } }; return PupilDetails.EntitySettings(entity, ID, referenceID, extensionData); }
internal void SerializationInProgress(StreamingContext context) { if (InternalAction == null) { return; } var settings = new DataContractJsonSerializerSettings(); settings.UseSimpleDictionaryFormat = true; var serializer = new DataContractJsonSerializer(InternalAction.GetType(), settings); var stream = new MemoryStream(); serializer.WriteObject(stream, InternalAction); stream.Position = 0; var deserializer = new DataContractJsonSerializer(typeof(FormulaAction), settings); var temp = deserializer.ReadObject(stream) as FormulaAction; edo = temp.edo; }
void ReadClass(ClassDataContract classContract) { if (classContract.HasExtensionData) { ExtensionDataObject extensionData = new ExtensionDataObject(); ReadMembers(classContract, extensionData); ClassDataContract currentContract = classContract; while (currentContract != null) { MethodInfo extensionDataSetMethod = currentContract.ExtensionDataSetMethod; if (extensionDataSetMethod != null) { extensionDataSetMethod.Invoke(objectLocal, new object [] { extensionData }); } currentContract = currentContract.BaseContract; } } else { ReadMembers(classContract, null); } }
protected override void ReflectionReadMembers(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, XmlDictionaryString[] memberNames, XmlDictionaryString[] memberNamespaces, ClassDataContract classContract, ref object obj) { var jsonContext = context as XmlObjectSerializerReadContextComplexJson; Debug.Assert(jsonContext != null); int memberCount = classContract.MemberNames.Length; context.IncrementItemCount(memberCount); DataMember[] members = new DataMember[memberCount]; ReflectionGetMembers(classContract, members); int memberIndex = -1; ExtensionDataObject extensionData = null; if (classContract.HasExtensionData) { extensionData = new ExtensionDataObject(); ((IExtensibleDataObject)obj).ExtensionData = extensionData; } while (true) { if (!XmlObjectSerializerReadContext.MoveToNextElement(xmlReader)) { return; } memberIndex = jsonContext.GetJsonMemberIndex(xmlReader, memberNames, memberIndex, extensionData); // GetMemberIndex returns memberNames.Length if member not found if (memberIndex < members.Length) { ReflectionReadMember(xmlReader, context, classContract, ref obj, memberIndex, members); } } }
void WriteClass(ClassDataContract classContract) { InvokeOnSerializing(classContract, objLocal, context); if (classContract.IsISerializable) { context.WriteJsonISerializable(writer, (ISerializable)objLocal); } else { if (classContract.HasExtensionData) { ExtensionDataObject extensionData = ((IExtensibleDataObject)objLocal).ExtensionData; context.WriteExtensionData(writer, extensionData, -1); WriteMembers(classContract, extensionData, classContract); } else { WriteMembers(classContract, null, classContract); } } InvokeOnSerialized(classContract, objLocal, context); }
int WriteMembers (ClassDataContract classContract, ExtensionDataObject extensionData, ClassDataContract derivedMostClassContract) { int memberCount = (classContract.BaseContract == null) ? 0 : WriteMembers (classContract.BaseContract, extensionData, derivedMostClassContract); context.IncrementItemCount (classContract.Members.Count); for (int i = 0; i < classContract.Members.Count; i++, memberCount++) { DataMember member = classContract.Members[i]; Type memberType = member.MemberType; object memberValue = null; if (member.IsGetOnlyCollection) context.StoreIsGetOnlyCollection (); bool doWrite = true, hasMemberValue = false; if (!member.EmitDefaultValue) { hasMemberValue = true; memberValue = LoadMemberValue (member); doWrite = !IsDefaultValue (memberType, memberValue); } if (doWrite) { bool requiresNameAttribute = DataContractJsonSerializer.CheckIfXmlNameRequiresMapping (classContract.MemberNames [i]); if (requiresNameAttribute || !TryWritePrimitive(memberType, hasMemberValue ? () => memberValue : (Func<object>) null, member.MemberInfo, null /*arrayItemIndex*/, null /*nameLocal*/, i + childElementIndex)) { // Note: DataContractSerializer has member-conflict logic here to deal with the schema export // requirement that the same member can't be of two different types. if (requiresNameAttribute) XmlObjectSerializerWriteContextComplexJson.WriteJsonNameWithMapping (writer, memberNames, i + childElementIndex); else WriteStartElement (null /*nameLocal*/, i + childElementIndex); if (memberValue == null) memberValue = LoadMemberValue (member); WriteValue (memberType, memberValue); WriteEndElement (); } if (classContract.HasExtensionData) context.WriteExtensionData (writer, extensionData, memberCount); } else if (!member.EmitDefaultValue) { if (member.IsRequired) XmlObjectSerializerWriteContext.ThrowRequiredMemberMustBeEmitted (member.Name, classContract.UnderlyingType); } } typeIndex++; childElementIndex += classContract.Members.Count; return memberCount; }
public int GetJsonMemberIndex(XmlReaderDelegator xmlReader, XmlDictionaryString[] memberNames, int memberIndex, ExtensionDataObject extensionData) { int length = memberNames.Length; if (length != 0) { for (int i = 0, index = (memberIndex + 1) % length; i < length; i++, index = (index + 1) % length) { if (xmlReader.IsStartElement(memberNames[index], XmlDictionaryString.Empty)) { return index; } } string name; if (TryGetJsonLocalName(xmlReader, out name)) { for (int i = 0, index = (memberIndex + 1) % length; i < length; i++, index = (index + 1) % length) { if (memberNames[index].Value == name) { return index; } } } } HandleMemberNotFound(xmlReader, extensionData, memberIndex); return length; }
/// <summary> /// Create enrolment details for pupil /// </summary> /// <param name="id"></param> /// <param name="learnerEnrolmentId"></param> /// <param name="enrolmentStatusID"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="referenceID"></param> /// <param name="collectionCount"></param> /// <param name="extensionData"></param> /// <returns></returns> public DataEntityDTO CreateLearnerEnrolmentStatus(Guid id, Guid learnerEnrolmentId, Guid enrolmentStatusID, string startDate, string endDate, int referenceID, int collectionCount, ExtensionDataObject extensionData) { DataEntityDTO.SimplePropertyDTOGuid IDProperty = new DataEntityDTO.SimplePropertyDTOGuid { Value = id }; DataEntityDTO.SimplePropertyDTODate StartDateProperty = new DataEntityDTO.SimplePropertyDTODate { Value = new Date { internalDateTime = DateTime.Parse(startDate) } }; DataEntityDTO.ReferencePropertyDTO learnerEnrolmentProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = learnerEnrolmentId }; DataEntityDTO.ReferencePropertyDTO enrolmentStatusProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = enrolmentStatusID }; DataEntityDTO entity = new DataEntityDTO { EntityName = "LearnerEnrolmentStatus", Values = new Dictionary <string, DataEntityDTO.SimplePropertyDTO> { { "ID", IDProperty }, { "StartDate", StartDateProperty }, { "LearnerEnrolment", learnerEnrolmentProperty }, { "EnrolmentStatus", enrolmentStatusProperty } } }; if (string.IsNullOrEmpty(endDate)) { return(DataExchangeDetail.EntitySettings(entity, id, referenceID, extensionData)); } DataEntityDTO.SimplePropertyDTODate endDateProperty = new DataEntityDTO.SimplePropertyDTODate { Value = new Date { internalDateTime = DateTime.Parse(endDate) } }; entity.Values.Add("EndDate", endDateProperty); return(DataExchangeDetail.EntitySettings(entity, id, referenceID, extensionData)); }
/// <summary> /// Create learner yeargroup Data entity /// </summary> /// <param name="ID"></param> /// <param name="learnerId"></param> /// <param name="startDate"></param> /// <param name="yeargroup"></param> /// <param name="collectionCount"></param> /// <param name="referenceID"></param> /// <param name="extensionData"></param> /// <returns></returns> public DataEntityDTO CreateLearnerYearGroup(Guid ID, Guid learnerId, string startDate, Guid yeargroup, int referenceID, int collectionCount, ExtensionDataObject extensionData) { DataEntityDTO.SimplePropertyDTOGuid IDProperty = new DataEntityDTO.SimplePropertyDTOGuid { Value = ID }; DataEntityDTO.SimplePropertyDTODate StartDateProperty = new DataEntityDTO.SimplePropertyDTODate { Value = new Date { internalDateTime = DateTime.Parse(startDate) } }; DataEntityDTO.ReferencePropertyDTO yearGroupProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = yeargroup }; DataEntityDTO.ReferencePropertyDTO LearnerProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = learnerId, InternalReferenceID = (short?)collectionCount }; DataEntityDTO entity = new DataEntityDTO { EntityName = "LearnerYearGroupMembership", Values = new Dictionary <string, DataEntityDTO.SimplePropertyDTO> { { "ID", IDProperty }, { "StartDate", StartDateProperty }, { "Learner", LearnerProperty }, { "YearGroup", yearGroupProperty } } }; return(DataExchangeDetail.EntitySettings(entity, ID, referenceID, extensionData)); }
/// <summary> /// Create enrolment details for pupil /// </summary> /// <param name="ID"></param> /// <param name="learnerId"></param> /// <param name="startDate"></param> /// <param name="leavingDate"></param> /// <param name="schoolId"></param> /// <param name="referenceID"></param> /// <param name="collectionCount"></param> /// <param name="extensionData"></param> /// <returns></returns> public DataEntityDTO CreateLearnerEnrolment(Guid ID, Guid learnerId, string startDate, string leavingDate, Guid schoolId, int referenceID, int collectionCount, ExtensionDataObject extensionData) { DataEntityDTO.SimplePropertyDTOGuid IDProperty = new DataEntityDTO.SimplePropertyDTOGuid { Value = ID }; DataEntityDTO.SimplePropertyDTODate StartDateProperty = new DataEntityDTO.SimplePropertyDTODate { Value = new Date { internalDateTime = DateTime.Parse(startDate) } }; DataEntityDTO.ReferencePropertyDTO schoolProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = schoolId }; DataEntityDTO.ReferencePropertyDTO LearnerProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = learnerId }; DataEntityDTO entity = new DataEntityDTO { EntityName = "LearnerEnrolment", Values = new Dictionary <string, DataEntityDTO.SimplePropertyDTO> { { "ID", IDProperty }, { "DOA", StartDateProperty }, { "Learner", LearnerProperty }, { "School", schoolProperty } } }; if (string.IsNullOrEmpty(leavingDate)) { return(DataExchangeDetail.EntitySettings(entity, ID, referenceID, extensionData)); } DataEntityDTO.SimplePropertyDTODate DOLProperty = new DataEntityDTO.SimplePropertyDTODate { Value = new Date { internalDateTime = DateTime.Parse(leavingDate) } }; entity.Values.Add("DOL", DOLProperty); return(DataExchangeDetail.EntitySettings(entity, ID, referenceID, extensionData)); }
/// <summary> /// Create pupil data /// </summary> /// <param name="ID"></param> /// <param name="legalForename"></param> /// <param name="legalSurname"></param> /// <param name="dateOfBirth"></param> /// <param name="genderID"></param> /// <param name="UPN"></param> /// <param name="admissionNo"></param> /// <param name="schoolID"></param> /// <param name="referenceID"></param> /// <param name="extensionData"></param> /// <returns></returns> public DataEntityDTO CreatePupil(Guid ID, string legalForename, string legalSurname, string dateOfBirth, Guid genderID, Guid yeargroupID, string UPN, string admissionNo, Guid schoolID, int referenceID, ExtensionDataObject extensionData) { DataEntityDTO.SimplePropertyDTOGuid IDProperty = new DataEntityDTO.SimplePropertyDTOGuid { Value = ID }; DataEntityDTO.SimplePropertyDTOString legalForenameProperty = new DataEntityDTO.SimplePropertyDTOString { Value = legalForename }; DataEntityDTO.SimplePropertyDTOString legalSurnameProperty = new DataEntityDTO.SimplePropertyDTOString { Value = legalSurname }; DataEntityDTO.SimplePropertyDTODate dateOfBirthProperty = new DataEntityDTO.SimplePropertyDTODate { Value = new Date { internalDateTime = DateTime.Parse(dateOfBirth) } }; DataEntityDTO.ReferencePropertyDTO schoolProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = schoolID }; DataEntityDTO.ReferencePropertyDTO genderProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = genderID }; DataEntityDTO.ReferencePropertyDTO yeargroupProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = yeargroupID }; DataEntityDTO.SimplePropertyDTOString admissionNoProperty = new DataEntityDTO.SimplePropertyDTOString { Value = admissionNo }; DataEntityDTO.SimplePropertyDTOString UPNProperty = new DataEntityDTO.SimplePropertyDTOString { Value = UPN }; DataEntityDTO entity = new DataEntityDTO { EntityName = "Learner", Values = new Dictionary <string, DataEntityDTO.SimplePropertyDTO> { { "ID", IDProperty }, { "LegalForename", legalForenameProperty }, { "LegalSurname", legalSurnameProperty }, { "DateOfBirth", dateOfBirthProperty }, { "AdmissionNumber", admissionNoProperty }, { "UPN", UPNProperty }, { "Gender", genderProperty }, { "School", schoolProperty }, { "YearGroup", yeargroupProperty } } }; return(DataExchangeDetail.EntitySettings(entity, ID, referenceID, extensionData)); }
void ReadMembers (ClassDataContract classContract, ExtensionDataObject extensionData) { int memberCount = classContract.MemberNames.Length; context.IncrementItemCount (memberCount); int memberIndex = -1; // JSON intrinsic part. BitFlagsGenerator expectedElements = new BitFlagsGenerator (memberCount); byte [] requiredElements = new byte [expectedElements.GetLocalCount ()]; SetRequiredElements (classContract, requiredElements); SetExpectedElements (expectedElements, 0 /*startIndex*/); while (XmlObjectSerializerReadContext.MoveToNextElement (xmlReader)) { int idx; // used as in "switch (idx)" in the original source. idx = context.GetJsonMemberIndex (xmlReader, memberNames, memberIndex, extensionData); if (memberCount > 0) ReadMembers (idx, classContract, expectedElements, ref memberIndex); } if (!CheckRequiredElements (expectedElements, requiredElements)) XmlObjectSerializerReadContextComplexJson.ThrowMissingRequiredMembers (objectLocal, memberNames, expectedElements.LoadArray (), requiredElements); }
void ReadClass (ClassDataContract classContract) { if (classContract.HasExtensionData) { ExtensionDataObject extensionData = new ExtensionDataObject (); ReadMembers (classContract, extensionData); ClassDataContract currentContract = classContract; while (currentContract != null) { MethodInfo extensionDataSetMethod = currentContract.ExtensionDataSetMethod; if (extensionDataSetMethod != null) extensionDataSetMethod.Invoke (objectLocal, new object [] {extensionData}); currentContract = currentContract.BaseContract; } } else ReadMembers (classContract, null); }
public ExtensionDataObjectSerializationProxy(ExtensionDataObject extensionData) { this.extensionDataField = extensionData; }
int WriteMembers(ClassDataContract classContract, ExtensionDataObject extensionData, ClassDataContract derivedMostClassContract) { int memberCount = (classContract.BaseContract == null) ? 0 : WriteMembers(classContract.BaseContract, extensionData, derivedMostClassContract); context.IncrementItemCount(classContract.Members.Count); for (int i = 0; i < classContract.Members.Count; i++, memberCount++) { DataMember member = classContract.Members[i]; Type memberType = member.MemberType; object memberValue = null; if (member.IsGetOnlyCollection) { context.StoreIsGetOnlyCollection(); } bool doWrite = true, hasMemberValue = false; if (!member.EmitDefaultValue) { hasMemberValue = true; memberValue = LoadMemberValue(member); doWrite = !IsDefaultValue(memberType, memberValue); } if (doWrite) { bool requiresNameAttribute = DataContractJsonSerializer.CheckIfXmlNameRequiresMapping(classContract.MemberNames [i]); if (requiresNameAttribute || !TryWritePrimitive(memberType, hasMemberValue ? () => memberValue : (Func <object>)null, member.MemberInfo, null /*arrayItemIndex*/, null /*nameLocal*/, i + childElementIndex)) { // Note: DataContractSerializer has member-conflict logic here to deal with the schema export // requirement that the same member can't be of two different types. if (requiresNameAttribute) { XmlObjectSerializerWriteContextComplexJson.WriteJsonNameWithMapping(writer, memberNames, i + childElementIndex); } else { WriteStartElement(null /*nameLocal*/, i + childElementIndex); } if (memberValue == null) { memberValue = LoadMemberValue(member); } WriteValue(memberType, memberValue); WriteEndElement(); } if (classContract.HasExtensionData) { context.WriteExtensionData(writer, extensionData, memberCount); } } else if (!member.EmitDefaultValue) { if (member.IsRequired) { XmlObjectSerializerWriteContext.ThrowRequiredMemberMustBeEmitted(member.Name, classContract.UnderlyingType); } } } typeIndex++; childElementIndex += classContract.Members.Count; return(memberCount); }
public static DataEntityDTO EntitySettings(DataEntityDTO entity, Guid ID, int reference, ExtensionDataObject extensionData) { entity.ReferenceID = reference; entity.ID = ID; entity.DataModelContextID = "sims8_team1"; entity.DataModelType = new DataEntityDTO.DataModelTypeDTO { SchemaName = "dbo", DataModelPurpose = "BusinessDataModel", ExtensionData = extensionData }; entity.ExtensionData = extensionData; return(entity); }
/// <summary> /// Create SEN Status entity /// </summary> /// <param name="ID"></param> /// <param name="SENStatusID"></param> /// <param name="startDate"></param> /// <param name="learnerID"></param> /// <param name="collectionCount"></param> /// <param name="referenceID"></param> /// <param name="extensionData"></param> /// <returns></returns> public DataEntityDTO CreateSENStatus(Guid ID, Guid SENStatusID, string startDate, Guid learnerID, int referenceID, int collectionCount, ExtensionDataObject extensionData) { DataEntityDTO.SimplePropertyDTOGuid IDProperty = new DataEntityDTO.SimplePropertyDTOGuid { Value = ID }; DataEntityDTO.SimplePropertyDTODate StartDateProperty = new DataEntityDTO.SimplePropertyDTODate { Value = new Date { internalDateTime = DateTime.Parse(startDate) } }; DataEntityDTO.ReferencePropertyDTO senStatusProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = SENStatusID }; DataEntityDTO.ReferencePropertyDTO LearnerProperty = new DataEntityDTO.ReferencePropertyDTO { EntityPrimaryKey = learnerID, InternalReferenceID = (short?)collectionCount }; DataEntityDTO entity = new DataEntityDTO { EntityName = "LearnerSENStatus", Values = new Dictionary <string, DataEntityDTO.SimplePropertyDTO> { { "ID", IDProperty }, { "StartDate", StartDateProperty }, { "Learner", LearnerProperty }, { "SENStatus", senStatusProperty } } }; return(DataExchangeDetail.EntitySettings(entity, ID, referenceID, extensionData)); }
public int GetJsonMemberIndex(XmlReaderDelegator xmlReader, XmlDictionaryString[] memberNames, int memberIndex, ExtensionDataObject extensionData) { int length = memberNames.Length; if (length != 0) { for (int i = 0, index = (memberIndex + 1) % length; i < length; i++, index = (index + 1) % length) { if (xmlReader.IsStartElement(memberNames[index], XmlDictionaryString.Empty)) { return(index); } } string name; if (TryGetJsonLocalName(xmlReader, out name)) { for (int i = 0, index = (memberIndex + 1) % length; i < length; i++, index = (index + 1) % length) { if (memberNames[index].Value == name) { return(index); } } } } HandleMemberNotFound(xmlReader, extensionData, memberIndex); return(length); }
public int GetJsonMemberIndex(XmlReaderDelegator xmlReader, XmlDictionaryString[] memberNames, int memberIndex, ExtensionDataObject extensionData) { int length = memberNames.Length; if (length != 0) { string str; int num2 = 0; for (int i = (memberIndex + 1) % length; num2 < length; i = (i + 1) % length) { if (xmlReader.IsStartElement(memberNames[i], XmlDictionaryString.Empty)) { return(i); } num2++; } if (TryGetJsonLocalName(xmlReader, out str)) { int num4 = 0; for (int j = (memberIndex + 1) % length; num4 < length; j = (j + 1) % length) { if (memberNames[j].Value == str) { return(j); } num4++; } } } base.HandleMemberNotFound(xmlReader, extensionData, memberIndex); return(length); }