public static ConcreteNavigationProperty ForConcrete(OdcmProperty odcmProperty)
 {
     return(new ConcreteNavigationProperty(odcmProperty)
     {
         DefiningInterface = NamesService.GetConcreteInterfaceName(odcmProperty.Class),
     });
 }
Пример #2
0
 private ConcreteNavigationCollectionProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName  = NamesService.GetConcreteFieldName(odcmProperty);
     OdcmType   = odcmProperty.Type;
     PrivateSet = true;
     Type       = new Type(NamesService.GetExtensionTypeName("IPagedCollection"),
                           new Type(NamesService.GetConcreteInterfaceName(odcmProperty.Type)));
 }
Пример #3
0
 public CollectionExecuteAsyncMethod(OdcmClass odcmClass)
 {
     Name       = "ExecuteAsync";
     Parameters = Parameter.Empty;
     ReturnType = new Type(new Identifier("global::System.Threading.Tasks", "Task"),
                           new Type(NamesService.GetExtensionTypeName("IPagedCollection"),
                                    new Type(NamesService.GetConcreteInterfaceName(odcmClass))));
 }
 public FetcherExecuteAsyncMethod(OdcmClass odcmClass)
 {
     IsAsync      = true;
     IsOverriding = odcmClass.Base is OdcmClass && !((OdcmClass)odcmClass.Base).IsAbstract;
     Name         = "ExecuteAsync";
     Parameters   = Parameter.Empty;
     ReturnType   = new Type(new Identifier("global::System.Threading.Tasks", "Task"),
                             new Type(NamesService.GetConcreteInterfaceName(odcmClass)));
 }
 public ConcreteExecuteAsyncMethod(OdcmType odcmType)
 {
     EntityIdentifier  = NamesService.GetConcreteInterfaceName(odcmType);
     DefiningInterface = NamesService.GetFetcherInterfaceName(odcmType);
     Name       = "ExecuteAsync";
     Parameters = Parameter.Empty;
     ReturnType = new Type(new Identifier("global::System.Threading.Tasks", "Task"),
                           new Type(NamesService.GetConcreteInterfaceName(odcmType)));
 }
Пример #6
0
        public static IEnumerable <Type> ForConcrete(OdcmClass odcmClass)
        {
            var retVal = new List <Type>
            {
                new Type(NamesService.GetConcreteInterfaceName(odcmClass)),
                new Type(NamesService.GetFetcherInterfaceName(odcmClass))
            };

            return(retVal);
        }
Пример #7
0
 public static Interface ForConcrete(OdcmClass odcmClass)
 {
     return(new Interface
     {
         Identifier = NamesService.GetConcreteInterfaceName(odcmClass),
         Methods = global::CSharpWriter.Methods.ForConcreteInterface(odcmClass),
         Namespace = odcmClass.Namespace,
         Properties = global::CSharpWriter.Properties.ForConcreteInterface(odcmClass),
         Interfaces = global::CSharpWriter.Interfaces.ForConcreteInterface(odcmClass)
     });
 }
Пример #8
0
        public AddAsyncMethod(OdcmClass odcmClass)
        {
            Name = "Add" + odcmClass.Name + "Async";

            Parameters = new[]
            {
                new Parameter(new Type(NamesService.GetConcreteInterfaceName(odcmClass)), "item"),
                new Parameter(new Type(NamesService.GetPrimitiveTypeName("Boolean")), "dontSave", "false")
            };

            ReturnType = new Type(Identifier.Task);
        }
        public ContainerAddToCollectionMethod(OdcmProperty odcmProperty)
        {
            Name = "AddTo" + odcmProperty.Name;

            ModelCollectionName = odcmProperty.Name;

            Parameters = new[]
            {
                new Parameter(new Type(NamesService.GetConcreteInterfaceName(odcmProperty.Type)), odcmProperty.Name.ToLowerCamelCase()),
            };

            ReturnType = Type.Void;
        }
Пример #10
0
 public static Class ForCollection(OdcmClass odcmClass)
 {
     return(new Class
     {
         AccessModifier = "internal ",
         BaseClass = new Type(NamesService.GetExtensionTypeName("QueryableSet"),
                              new Type(NamesService.GetConcreteInterfaceName(odcmClass))),
         Constructors = global::CSharpWriter.Constructors.ForCollection(odcmClass),
         Interfaces = global::CSharpWriter.Interfaces.ForCollection(odcmClass),
         Identifier = NamesService.GetCollectionTypeName(odcmClass),
         Methods = global::CSharpWriter.Methods.ForCollection(odcmClass),
         Indexers = global::CSharpWriter.Indexers.ForCollection(odcmClass)
     });
 }
Пример #11
0
        public static IEnumerable <Type> ForConcreteInterface(OdcmClass odcmClass)
        {
            var retVal = new List <Type>();

            var baseClass = odcmClass.Base as OdcmClass;

            var interfaceIdentifier = baseClass == null?
                                      NamesService.GetExtensionTypeName("IEntityBase") :
                                          NamesService.GetConcreteInterfaceName(baseClass);

            retVal.Add(new Type(interfaceIdentifier));

            return(retVal);
        }
Пример #12
0
        private void Write(ConcreteNavigationCollectionProperty property)
        {
            WriteDeclaration(property);

            using (_builder.IndentBraced)
            {
                _("get");

                using (_builder.IndentBraced)
                {
                    _("return new {0}<{1}, {2}>(Context, ({3}<{2}>) {4});",
                      NamesService.GetExtensionTypeName("PagedCollection"),
                      NamesService.GetConcreteInterfaceName(property.OdcmType),
                      NamesService.GetConcreteTypeName(property.OdcmType),
                      NamesService.GetExtensionTypeName("EntityCollectionImpl"),
                      property.FieldName);
                }
            }
        }
Пример #13
0
 public EnsureQueryMethod(OdcmClass odcmClass)
 {
     IsPublic         = false;
     Name             = "EnsureQuery";
     FetchedType      = NamesService.GetPublicTypeName(odcmClass);
     QueryableSetType = new Type(NamesService.GetExtensionTypeName("ReadOnlyQueryableSet"), new Type(NamesService.GetPublicTypeName(odcmClass)));
     ReturnType       = new Type(NamesService.GetExtensionTypeName("IReadOnlyQueryableSet"), new Type(NamesService.GetConcreteInterfaceName(odcmClass)));
 }
Пример #14
0
 public static Interface ForCollection(OdcmClass odcmClass)
 {
     return(new Interface
     {
         Attributes = new[] { Attribute.ForLowerCaseProperty() },
         Identifier = NamesService.GetCollectionInterfaceName(odcmClass),
         Namespace = odcmClass.Namespace,
         Methods = global::CSharpWriter.Methods.ForCollectionInterface(odcmClass),
         Indexers = IndexerSignature.ForCollectionInterface(odcmClass),
         Interfaces = new[] { new Type(NamesService.GetExtensionTypeName("IReadOnlyQueryableSetBase"), new Type(NamesService.GetConcreteInterfaceName(odcmClass))) }
     });
 }
 protected ConcreteNavigationProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     FieldName = NamesService.GetPropertyFieldName(odcmProperty);
     FieldType = NamesService.GetConcreteTypeName(odcmProperty.Type);
     Type      = new Type(NamesService.GetConcreteInterfaceName(odcmProperty.Type));
 }
Пример #16
0
 private FetcherExpandMethod(OdcmClass odcmClass)
 {
     IsPublic          = true;
     Name              = "Expand";
     GenericParameters = new[] { "TTarget" };
     Parameters        = new[]
     {
         new Parameter(new Type(new Identifier("System.Linq.Expressions", "Expression"),
                                new Type(new Identifier("System", "Func"), new Type(NamesService.GetConcreteInterfaceName(odcmClass)),
                                         new Type(new Identifier(null, "TTarget")))), "navigationPropertyAccessor"),
     };
     ReturnType = new Type(NamesService.GetFetcherInterfaceName(odcmClass));
     OdcmClass  = odcmClass;
 }