示例#1
0
        public void Write(OdcmMethod odcmMethod)
        {
            var returnType = NamesService.GetPublicTypeName(odcmMethod.ReturnType);

            var parameters = string.Join(", ",
                                         (from i in odcmMethod.Parameters select NamesService.GetPublicTypeName(i.Type, i.IsCollection) + " " + i.Name));
        }
示例#2
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)));
 }
示例#3
0
 public static Class ForComplex(OdcmClass odcmClass)
 {
     return(new Class
     {
         AbstractModifier = odcmClass.IsAbstract ? "abstract " : string.Empty,
         AccessModifier = "public ",
         Constructors = global::CSharpWriter.Constructors.ForComplex(odcmClass),
         BaseClass =
             new Type(odcmClass.Base == null
                 ? NamesService.GetExtensionTypeName("ComplexTypeBase")
                 : NamesService.GetPublicTypeName(odcmClass.Base)),
         Fields = global::CSharpWriter.Fields.ForComplex(odcmClass),
         Identifier = NamesService.GetConcreteTypeName(odcmClass),
         Properties = global::CSharpWriter.Properties.ForComplex(odcmClass),
     });
 }
 public EntityFunctionMethod(OdcmMethod odcmMethod)
 {
     InstanceName = NamesService.GetConcreteTypeName(odcmMethod.ReturnType);
     IsAsync      = true;
     ModelName    = odcmMethod.Name;
     Name         = odcmMethod.Name + "Async";
     Parameters   = odcmMethod.Parameters.Select(Parameter.FromOdcmParameter);
     ReturnType   = new Type(new Identifier("System.Threading.Tasks", "Task"), new Type(NamesService.GetPublicTypeName(odcmMethod.ReturnType)));
 }
示例#5
0
 public static Type GetParameterType(OdcmParameter parameter)
 {
     return(parameter.IsNullable && IsValueType(parameter.Type) && !(parameter.Type is OdcmEnum)
         ? GetNullableType(parameter.Type)
         : new Type(NamesService.GetPublicTypeName(parameter.Type)));
 }
示例#6
0
 public static Type GetPropertyType(OdcmProperty property)
 {
     return(property.IsNullable && IsValueType(property.Type) && !(property.Type is OdcmEnum)
         ? GetNullableType(property.Type)
         : new Type(NamesService.GetPublicTypeName(property.Type)));
 }
示例#7
0
 public static Type GetNullableType(OdcmType type)
 {
     return(new Type(new Identifier("System", "Nullable"), new Type(NamesService.GetPublicTypeName(type))));
 }
 private StructuralCollectionProperty(OdcmProperty odcmProperty) : base(odcmProperty)
 {
     InstanceType = new Type(NamesService.GetPublicTypeName(odcmProperty.Type));
     ModelName    = odcmProperty.Name;
     Type         = new Type(new Identifier("System.Collections.Generic", "IList"), InstanceType);
 }
示例#9
0
 public void Write(OdcmField odcmField)
 {
     _("private {0} {1};", NamesService.GetPublicTypeName(odcmField.Type).FullName, odcmField.Name);
 }