public static FilterType? TryGetFilterType(Type type) { var uType = type.UnNullify(); if (uType == typeof(Guid)) return FilterType.Guid; if (uType.IsEnum) return FilterType.Enum; switch (Type.GetTypeCode(uType)) { case TypeCode.Boolean: return FilterType.Boolean; case TypeCode.Double: case TypeCode.Decimal: case TypeCode.Single: return FilterType.Decimal; case TypeCode.Byte: case TypeCode.SByte: case TypeCode.Int16: case TypeCode.Int32: case TypeCode.Int64: case TypeCode.UInt16: case TypeCode.UInt32: case TypeCode.UInt64: return FilterType.Integer; case TypeCode.DateTime: return FilterType.DateTime; case TypeCode.Char: case TypeCode.String: return FilterType.String; case TypeCode.Object: if (type.IsLite()) return FilterType.Lite; if (type.IsIEntity()) return FilterType.Lite; if (type.IsEmbeddedEntity()) return FilterType.Embedded; goto default; default: return null; } }
internal static Entities.Implementations? GetImplementations(PropertyRoute[] propertyRoutes, Type cleanType) { if (!cleanType.IsIEntity() && !cleanType.IsLite()) return (Implementations?)null; var only = propertyRoutes.Only(); if (only != null && only.PropertyRouteType == PropertyRouteType.Root) return Signum.Entities.Implementations.By(cleanType); var aggregate = AggregateImplementations(propertyRoutes.Select(pr => pr.GetImplementations())); return aggregate; }