Ejemplo n.º 1
0
        public static IEnumerable <Method> ForConcrete(OdcmClass odcmClass)
        {
            var retVal = Methods.ForConcreteInterface(odcmClass).ToList();

            retVal.Add(new EnsureQueryMethod(odcmClass));

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

            if (!odcmClass.IsAbstract)
            {
                retVal.Add(new ConcreteExecuteAsyncMethod(odcmClass));
                retVal.Add(FetcherExpandMethod.ForConcrete(odcmClass));
            }

            return(retVal);
        }
Ejemplo n.º 2
0
        public static IEnumerable <Method> ForFetcherInterface(OdcmClass odcmClass)
        {
            var retVal = new List <Method>();

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

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

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

            return(retVal);
        }
Ejemplo n.º 3
0
        private void Write(FetcherExpandMethod method)
        {
            WriteSignature(method);
            using (_builder.IndentBraced)
            {
                if (method.DefiningInterface == null)
                {
                    _("return ({0}) new {1}()",
                      NamesService.GetFetcherInterfaceName(method.OdcmClass),
                      NamesService.GetFetcherTypeName(method.OdcmClass));

                    using (_builder.IndentBraced)
                    {
                        _("_query = this.EnsureQuery().Expand<TTarget>(navigationPropertyAccessor)");
                    }
                    _(";");
                }
                else
                {
                    _("return ({0}) this;", NamesService.GetFetcherInterfaceName(method.OdcmClass));
                }
            }
        }