public static Identifier GetConcreteTypeName(OdcmType odcmType) { if (odcmType is OdcmPrimitiveType) return GetPrimitiveTypeName(odcmType); return ResolveIdentifier(odcmType); }
public static Identifier GetPublicTypeName(OdcmType odcmType, bool isCollection) { if (odcmType == null) { return new Identifier(string.Empty, "void"); } if (odcmType.Namespace == OdcmNamespace.Edm) { return GetPrimitiveTypeName(odcmType); } if (odcmType is OdcmClass && ((OdcmClass)odcmType).Kind == OdcmClassKind.Entity) { return GetConcreteInterfaceName(odcmType); } if (odcmType is OdcmClass && ((OdcmClass)odcmType).Kind == OdcmClassKind.MediaEntity) { return GetConcreteInterfaceName(odcmType); } var resolvedName = ResolveIdentifier(odcmType); return new Identifier(resolvedName.Namespace, resolvedName.Name + (isCollection ? "[]" : string.Empty)); }
public static bool IsValueType(OdcmType type) { if (type == null) throw new ArgumentNullException("type"); return type is OdcmEnum || ( type is OdcmPrimitiveType && type.Namespace.Name.Equals("Edm", StringComparison.OrdinalIgnoreCase) && ( type.Name.Equals("Boolean", StringComparison.OrdinalIgnoreCase) || type.Name.Equals("Byte", StringComparison.OrdinalIgnoreCase) || type.Name.Equals("Date", StringComparison.OrdinalIgnoreCase) || type.Name.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase) || type.Name.Equals("Decimal", StringComparison.OrdinalIgnoreCase) || type.Name.Equals("Double", StringComparison.OrdinalIgnoreCase) || type.Name.Equals("Duration", StringComparison.OrdinalIgnoreCase) || type.Name.Equals("Int16", StringComparison.OrdinalIgnoreCase) || type.Name.Equals("Int32", StringComparison.OrdinalIgnoreCase) || type.Name.Equals("Int64", StringComparison.OrdinalIgnoreCase) || type.Name.Equals("SByte", StringComparison.OrdinalIgnoreCase) || type.Name.Equals("Single", StringComparison.OrdinalIgnoreCase) || type.Name.Equals("Guid", StringComparison.OrdinalIgnoreCase) || type.Name.Equals("TimeOfDay", StringComparison.OrdinalIgnoreCase) ) ); }
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))); }
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))); }
public void AddType(OdcmType type) { string @namespace = type.Namespace.Name; OdcmNamespace odcmNamespace = Namespaces.FirstOrDefault(x => x.Name == @namespace); if (odcmNamespace == null) { odcmNamespace = new OdcmNamespace(@namespace); Namespaces.Add(odcmNamespace); } _Types.Add(type); odcmNamespace.Types.Add(type); }
public void AddType(OdcmType type) { string @namespace = type.Namespace; OdcmNamespace odcmNamespace = null; foreach (OdcmNamespace candidate in Namespaces) { if (string.Equals(candidate.Name, @namespace)) { odcmNamespace = candidate; break; } } if (odcmNamespace == null) { odcmNamespace = new OdcmNamespace(@namespace); Namespaces.Add(odcmNamespace); } _Types.Add(type); odcmNamespace.Types.Add(type); }
public static Identifier GetPublicTypeName(OdcmType odcmType) { return GetPublicTypeName(odcmType, false); }
public ConcreteUpcastMethod(OdcmType baseType, OdcmType derivedType) : base(baseType, derivedType) { DefiningInterface = NamesService.GetFetcherInterfaceName(baseType); }
public UpcastMethodBase(OdcmType baseType, OdcmType derivedType) { BaseType = baseType; DerivedType = derivedType; Visibility = Visibility.Public; }
public FetcherUpcastMethod(OdcmType baseType, OdcmType derivedType) : base(baseType, derivedType) { Name = "To" + derivedType.Name; Parameters = global::Vipr.Writer.CSharp.Parameters.Empty; ReturnType = new Type(NamesService.GetFetcherInterfaceName(derivedType)); }
public static Identifier GetPrimitiveTypeName(OdcmType odcmType) { return GetPrimitiveTypeName(odcmType.Name); }
public static Identifier GetConcreteInterfaceName(OdcmType odcmType) { var resolvedName = ResolveIdentifier(odcmType); return new Identifier(resolvedName.Namespace, "I" + resolvedName.Name); }
private static Identifier ResolveIdentifier(OdcmType odcmType) { return ResolveIdentifier(odcmType.Namespace.Name, odcmType.Name); }
public static Type GetNullableType(OdcmType type) { return new Type(new Identifier("System", "Nullable"), new Type(NamesService.GetPublicTypeName(type))); }
public static Identifier GetFetcherInterfaceName(OdcmType odcmType) { var fetcherTypeName = GetFetcherTypeName(odcmType); return GetConcreteInterfaceName(fetcherTypeName); }
public static Identifier GetFetcherTypeName(OdcmType odcmType) { var resolvedName = ResolveIdentifier(odcmType); return new Identifier(resolvedName.Namespace, resolvedName.Name + "Fetcher"); }