예제 #1
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);
        }
예제 #2
0
        public static IEnumerable <Method> ForCollectionInterface(OdcmClass odcmClass, OdcmProjection projection)
        {
            var odcmMediaClass = odcmClass as OdcmMediaClass;

            if (odcmMediaClass != null)
            {
                return(ForMediaCollectionInterface(odcmMediaClass));
            }

            var retVal = new List <Method>();

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


            retVal.Add(new CollectionGetByIdMethod(odcmClass, projection));
            retVal.Add(new CollectionExecuteAsyncMethod(odcmClass));

            if (projection.SupportsUpdateLink())
            {
                retVal.Add(new CollectionAddLinkAsyncMethod(odcmClass));
            }
            if (projection.SupportsDeleteLink())
            {
                retVal.Add(new CollectionRemoveLinkAsyncMethod(odcmClass));
            }
            if (projection.SupportsInsert())
            {
                retVal.Add(new CollectionAddAsyncMethod(odcmClass));
            }
            if (projection.SupportsUpdate())
            {
                retVal.Add(new CollectionUpdateAsyncMethod(odcmClass));
            }
            if (projection.SupportsDelete())
            {
                retVal.Add(new CollectionDeleteAsyncMethod(odcmClass));
            }

            return(retVal);
        }