コード例 #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
ファイル: MetadataVisitor.cs プロジェクト: nuub666/framework
        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;
        }