コード例 #1
0
            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);
            }
コード例 #2
0
            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;
            }