internal UmbracoEntityDto Map(UmbracoEntityDto a, UmbracoPropertyDto p) { // Terminating call. Since we can return null from this function // we need to be ready for PetaPoco to callback later with null // parameters if (a == null) { return(Current); } // Is this the same UmbracoEntityDto as the current one we're processing if (Current != null && Current.UniqueId == a.UniqueId) { // Yes, just add this UmbracoPropertyDto to the current UmbracoEntityDto's collection Current.UmbracoPropertyDtos.Add(p); // Return null to indicate we're not done with this UmbracoEntityDto yet return(null); } // This is a different UmbracoEntityDto to the current one, or this is the // first time through and we don't have a Tab yet // Save the current UmbracoEntityDto var prev = Current; // Setup the new current UmbracoEntityDto Current = a; Current.UmbracoPropertyDtos = new List <UmbracoPropertyDto>(); Current.UmbracoPropertyDtos.Add(p); // Return the now populated previous UmbracoEntityDto (or null if first time through) return(prev); }
internal UmbracoEntity Map(dynamic a, UmbracoPropertyDto p) { // Terminating call. Since we can return null from this function // we need to be ready for PetaPoco to callback later with null // parameters if (a == null) { return(Current); } // Is this the same UmbracoEntity as the current one we're processing if (Current != null && Current.Key == a.uniqueID) { if (p != null && p.PropertyAlias.IsNullOrWhiteSpace() == false) { // Add this UmbracoProperty to the current additional data Current.AdditionalData[p.PropertyAlias] = new UmbracoEntity.EntityProperty { PropertyEditorAlias = p.PropertyEditorAlias, Value = p.NTextValue.IsNullOrWhiteSpace() ? p.NVarcharValue : p.NTextValue.ConvertToJsonIfPossible() }; } // Return null to indicate we're not done with this UmbracoEntity yet return(null); } // This is a different UmbracoEntity to the current one, or this is the // first time through and we don't have a Tab yet // Save the current UmbracoEntityDto var prev = Current; // Setup the new current UmbracoEntity Current = _factory.BuildEntityFromDynamic(a); if (p != null && p.PropertyAlias.IsNullOrWhiteSpace() == false) { //add the property/create the prop list if null Current.AdditionalData[p.PropertyAlias] = new UmbracoEntity.EntityProperty { PropertyEditorAlias = p.PropertyEditorAlias, Value = p.NTextValue.IsNullOrWhiteSpace() ? p.NVarcharValue : p.NTextValue.ConvertToJsonIfPossible() }; } // Return the now populated previous UmbracoEntity (or null if first time through) return(prev); }
internal UmbracoEntityDto Map(UmbracoEntityDto a, UmbracoPropertyDto p) { // Terminating call. Since we can return null from this function // we need to be ready for PetaPoco to callback later with null // parameters if (a == null) return Current; // Is this the same UmbracoEntityDto as the current one we're processing if (Current != null && Current.UniqueId == a.UniqueId) { // Yes, just add this UmbracoPropertyDto to the current UmbracoEntityDto's collection Current.UmbracoPropertyDtos.Add(p); // Return null to indicate we're not done with this UmbracoEntityDto yet return null; } // This is a different UmbracoEntityDto to the current one, or this is the // first time through and we don't have a Tab yet // Save the current UmbracoEntityDto var prev = Current; // Setup the new current UmbracoEntityDto Current = a; Current.UmbracoPropertyDtos = new List<UmbracoPropertyDto>(); Current.UmbracoPropertyDtos.Add(p); // Return the now populated previous UmbracoEntityDto (or null if first time through) return prev; }
internal UmbracoEntity Map(dynamic a, UmbracoPropertyDto p) { // Terminating call. Since we can return null from this function // we need to be ready for PetaPoco to callback later with null // parameters if (a == null) return Current; // Is this the same UmbracoEntity as the current one we're processing if (Current != null && Current.Key == a.uniqueID) { // Yes, just add this UmbracoProperty to the current UmbracoEntity's collection if (Current.UmbracoProperties == null) { Current.UmbracoProperties = new List<UmbracoEntity.UmbracoProperty>(); } Current.UmbracoProperties.Add(new UmbracoEntity.UmbracoProperty { PropertyEditorAlias = p.PropertyEditorAlias, Value = p.UmbracoFile }); // Return null to indicate we're not done with this UmbracoEntity yet return null; } // This is a different UmbracoEntity to the current one, or this is the // first time through and we don't have a Tab yet // Save the current UmbracoEntityDto var prev = Current; // Setup the new current UmbracoEntity Current = _factory.BuildEntityFromDynamic(a); //add the property/create the prop list if null Current.UmbracoProperties = new List<UmbracoEntity.UmbracoProperty> { new UmbracoEntity.UmbracoProperty { PropertyEditorAlias = p.PropertyEditorAlias, Value = p.UmbracoFile } }; // Return the now populated previous UmbracoEntity (or null if first time through) return prev; }