Пример #1
0
        internal static Type UnwrapPrimaryKey(Type type, PropertyRoute[] routes)
        {
            if (type.UnNullify() == typeof(PrimaryKey))
            {
                return routes.Select(r => PrimaryKey.Type(r.RootType)).Distinct().SingleEx().Nullify();
            }

            return type;
        }
Пример #2
0
        internal static Entities.Implementations? GetImplementations(PropertyRoute[] propertyRoutes, Type cleanType)
        {
            if (!cleanType.IsIIdentifiable() && !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;
        }
Пример #3
0
        internal static Expression UnwrapPrimaryKey(Expression expression, PropertyRoute[] routes)
        {
            if (expression.Type.UnNullify() == typeof(PrimaryKey))
            {
                var unwrappedType = routes.Select(r => PrimaryKey.Type(r.RootType)).Distinct().SingleEx();

                return Expression.Convert(Expression.Field(expression.UnNullify(), "Object"), unwrappedType.Nullify());
            }

            return expression;
        }