コード例 #1
0
        private static void MergeInheritedProperties(EntityFramework dataServices, ComplexType complexType)
        {
            ComplexType baseComplexType = dataServices.ResourceWithIdentifier <ComplexType>(complexType.BaseType);

            while (baseComplexType != null)
            {
                for (int i = baseComplexType.Properties.Count - 1; i >= 0; i--)
                {
                    if (!complexType.Properties.Contains(baseComplexType.Properties[i]))
                    {
                        complexType.Properties.Insert(0, baseComplexType.Properties[i]);
                    }
                }
                if (baseComplexType.BaseType != null)
                {
                    baseComplexType = dataServices.ResourceWithIdentifier <ComplexType>(baseComplexType.BaseType);
                }
                else
                {
                    break;
                }
            }
        }
コード例 #2
0
        public virtual IODataNavigable NavigateByUriComponent(string component, EntityFramework edmx)
        {
            var propertyMatch = (from p in this.Properties
                                 where p.Name == component
                                 select p).FirstOrDefault();

            if (null != propertyMatch)
            {
                var identifier = propertyMatch.Type;
                if (identifier.StartsWith("Collection("))
                {
                    var innerId = identifier.Substring(11, identifier.Length - 12);
                    return(new ODataCollection(innerId));
                }
                return(edmx.ResourceWithIdentifier <IODataNavigable>(identifier));
            }

            return(null);
        }
コード例 #3
0
        public IODataNavigable NavigateByUriComponent(string component, EntityFramework edmx)
        {
            string targetType = null;

            var entitySet = (from e in EntitySets
                             where e.Name == component
                             select e).FirstOrDefault();

            if (null != entitySet)
            {
                // EntitySet is always a collection of an item type
                targetType = "Collection(" + entitySet.EntityType + ")";
            }
            else
            {
                var singleton = (from s in Singletons
                                 where s.Name == component
                                 select s).FirstOrDefault();

                if (null != singleton)
                {
                    targetType = singleton.Type;
                }
            }

            if (targetType != null)
            {
                if (targetType.StartsWith("Collection("))
                {
                    var innerId = targetType.Substring(11, targetType.Length - 12);
                    return(new ODataCollection(innerId));
                }
                return(edmx.ResourceWithIdentifier <IODataNavigable>(targetType));
            }

            return(null);
        }
コード例 #4
0
        public IODataNavigable NavigateByUriComponent(string component, EntityFramework edmx)
        {
            string targetType = null;

            var entitySet = (from e in EntitySets
                             where e.Name == component
                             select e).FirstOrDefault();
            if (null != entitySet)
            {
                // EntitySet is always a collection of an item type
                targetType = "Collection(" + entitySet.EntityType + ")";
            }
            else
            {
                var singleton = (from s in Singletons
                                 where s.Name == component
                                 select s).FirstOrDefault();

                if (null != singleton)
                {
                    targetType = singleton.Type;
                }
            }

            if (targetType != null)
            {
                if (targetType.StartsWith("Collection("))
                {
                    var innerId = targetType.Substring(11, targetType.Length - 12);
                    return new ODataCollection(innerId);
                }
                return edmx.ResourceWithIdentifier<IODataNavigable>(targetType);
            }

            return null;
        }
コード例 #5
0
 public IODataNavigable NavigateByEntityTypeKey(EntityFramework edmx)
 {
     return(edmx.ResourceWithIdentifier <IODataNavigable>(this.TypeIdentifier));
 }
コード例 #6
0
 public IODataNavigable NavigateByEntityTypeKey(EntityFramework edmx)
 {
     return edmx.ResourceWithIdentifier<IODataNavigable>(this.TypeIdentifier);
 }
コード例 #7
0
        public virtual IODataNavigable NavigateByUriComponent(string component, EntityFramework edmx)
        {
            var propertyMatch = (from p in this.Properties
                where p.Name == component
                select p).FirstOrDefault();
            if (null != propertyMatch)
            {
                var identifier = propertyMatch.Type;
                if (identifier.StartsWith("Collection("))
                {
                    var innerId = identifier.Substring(11, identifier.Length - 12);
                    return new ODataCollection(innerId);
                }
                return edmx.ResourceWithIdentifier<IODataNavigable>(identifier);
            }

            return null;
        }