Exemple #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);
        }
Exemple #2
0
        private void Write(FetcherExpandMethod method)
        {
            WriteSignature(method);
            using (_builder.IndentBraced)
            {
                _("return ({0}) new {1}()",
                  method.ReturnType.TypeIdentifier,
                  NamesService.GetFetcherTypeName(method.OdcmClass));

                using (_builder.IndentBraced)
                {
                    _("_query = this.EnsureQuery().Expand<TTarget>(navigationPropertyAccessor)");
                }
                _(";");
            }
        }
Exemple #3
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);
        }