Example #1
0
        public static IEnumerable <Method> ForFetcherClass(OdcmClass odcmClass)
        {
            var retVal = new List <Method>();

            retVal.AddRange(Methods.ForEntityType(odcmClass));

            if (!odcmClass.IsAbstract)
            {
                retVal.Add(new FetcherExecuteAsyncMethod(odcmClass));

                foreach (var projection in odcmClass.DistinctProjections())
                {
                    if (projection.SupportsExpand())
                    {
                        retVal.Add(FetcherExpandMethod.ForFetcherClass(odcmClass, projection));
                    }
                }

                retVal.Add(FetcherUpdateMethod.ForFetcher(odcmClass));
                retVal.Add(FetcherSetMethod.ForFetcher(odcmClass));
                retVal.Add(FetcherUpdateLinkMethod.ForFetcher(odcmClass));
                retVal.Add(FetcherDeleteMethod.ForFetcher(odcmClass));
                retVal.Add(FetcherDeleteLinkMethod.ForFetcher(odcmClass));
                retVal.Add(FetcherSaveChangesAsyncMethod.ForFetcher(odcmClass));
            }

            if (!odcmClass.IsAbstract)
            {
                retVal.Add(new EnsureQueryMethod(odcmClass));
            }

            return(retVal);
        }
Example #2
0
        public static IEnumerable <Method> ForFetcherInterface(OdcmClass odcmClass, OdcmProjection projection)
        {
            var retVal = new List <Method>();

            retVal.AddRange(Methods.ForEntityType(odcmClass));

            if (!odcmClass.IsAbstract)
            {
                retVal.Add(new FetcherExecuteAsyncMethod(odcmClass));
                if (projection.SupportsExpand())
                {
                    retVal.Add(FetcherExpandMethod.ForFetcherInterface(odcmClass, projection));
                }

                if (projection.SupportsUpdate())
                {
                    retVal.Add(FetcherUpdateMethod.ForFetcher(odcmClass));
                    retVal.Add(FetcherSetMethod.ForFetcher(odcmClass));
                }

                if (projection.SupportsUpdateLink())
                {
                    retVal.Add(FetcherUpdateLinkMethod.ForFetcher(odcmClass));
                }

                if (projection.SupportsDelete())
                {
                    retVal.Add(FetcherDeleteMethod.ForFetcher(odcmClass));
                }

                if (projection.SupportsDeleteLink())
                {
                    retVal.Add(FetcherDeleteLinkMethod.ForFetcher(odcmClass));
                }

                retVal.Add(FetcherSaveChangesAsyncMethod.ForFetcher(odcmClass));
            }

            return(retVal);
        }