Exemplo n.º 1
0
        private bool isActive(FeedEntry feedEntry)
        {
            PropertyInfo propInfo = feedEntry.GetType().GetProperty("active");

            if (propInfo == null)
            {
                return(true);
            }
            bool prop = (bool)propInfo.GetValue(feedEntry, null);

            return(prop);
        }
        public virtual FeedEntry Merge(FeedEntry sourceEntry)
        {
            FeedEntry targetEntry = GetFeedEntry(sourceEntry.Key);

            string[] changedProperties = sourceEntry.GetChangedProperties();
            foreach (string propName in changedProperties)
            {
                PropertyInfo propInfo = targetEntry.GetType().GetProperty(propName);
                if (propInfo != null && propInfo.CanWrite)
                {
                    object value = propInfo.GetValue(sourceEntry, null);
                    propInfo.SetValue(targetEntry, value, null);
                }
            }
            return(targetEntry);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates and returns an array of feed entrylinks.
        /// </summary>
        /// <param name="resourcePayloadContainer"></param>
        /// <returns></returns>
        public static FeedLink[] CreateEntryLinks(RequestContext context, FeedEntry resourcePayloadContainer)
        {
            List <FeedLink> links = new List <FeedLink>();

#warning TODO!!!

            #region self link

            links.Add(new FeedLink(resourcePayloadContainer.Uri, LinkType.Self, MediaType.AtomEntry, "Refresh"));

            #endregion

            #region edit link

            switch (resourcePayloadContainer.GetType().Name)
            {
            case "":
            case "a":

                break;
            }

            #endregion

            #region schema link

            links.Add(new FeedLink(String.Format("{0}{1}/$schema", context.DatasetLink, context.ResourceKind.ToString()), LinkType.Schema, MediaType.Xml));

            #endregion

            #region template link

            //switch(resourcePayloadContainer.GetType().Name)
            //{
            //    case "":
            //    case "a":

            //        break;
            //}

            links.Add(new FeedLink(String.Format("{0}{1}/$template", context.DatasetLink, context.ResourceKind.ToString()), LinkType.Template, MediaType.AtomEntry));

            #endregion

            #region service link

            switch (resourcePayloadContainer.GetType().Name)
            {
            case "":
            case "a":

                break;
            }

            #endregion

            #region related links

            switch (resourcePayloadContainer.GetType().Name)
            {
            case "":
            case "a":

                break;
            }

            #endregion

            return(links.ToArray());
        }
Exemplo n.º 4
0
        private bool isActive(FeedEntry feedEntry)
        {
            PropertyInfo propInfo = feedEntry.GetType().GetProperty("active");
            if (propInfo == null)
                return true;
            bool prop = (bool)propInfo.GetValue(feedEntry, null);

            return prop;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates and returns an array of feed entrylinks.
        /// </summary>
        /// <param name="resourcePayloadContainer"></param>
        /// <returns></returns>
        public static FeedLink[] CreateEntryLinks(RequestContext context, FeedEntry resourcePayloadContainer)
        {
            List<FeedLink> links = new List<FeedLink>();
            #warning TODO!!!

            #region self link

            links.Add(new FeedLink(resourcePayloadContainer.Uri, LinkType.Self, MediaType.AtomEntry, "Refresh"));

            #endregion

            #region edit link

            switch(resourcePayloadContainer.GetType().Name)
            {
                case "":
                case "a":

                    break;
            }

            #endregion

            #region schema link

            links.Add(new FeedLink(String.Format("{0}{1}/$schema", context.DatasetLink, context.ResourceKind.ToString()), LinkType.Schema, MediaType.Xml));

            #endregion

            #region template link

            //switch(resourcePayloadContainer.GetType().Name)
            //{
            //    case "":
            //    case "a":

            //        break;
            //}

            links.Add(new FeedLink(String.Format("{0}{1}/$template", context.DatasetLink, context.ResourceKind.ToString()), LinkType.Template, MediaType.AtomEntry));

            #endregion

            #region service link

            switch(resourcePayloadContainer.GetType().Name)
            {
                case "":
                case "a":

                    break;
            }

            #endregion

            #region related links

            switch(resourcePayloadContainer.GetType().Name)
            {
                case "":
                case "a":

                    break;
            }

            #endregion

            return links.ToArray();
        }