예제 #1
0
 static void EntityEventsGlobal_Saving(Entity ident)
 {
     if (ident.IsGraphModified &&
         EntityKindCache.RequiresSaveOperation(ident.GetType()) && !AllowSaveGlobally && !IsSaveAllowedInContext(ident.GetType()))
     {
         throw new InvalidOperationException("Saving '{0}' is controlled by the operations. Use OperationLogic.AllowSave<{0}>() or execute {1}".FormatWith(
                                                 ident.GetType().Name,
                                                 operations.GetValue(ident.GetType()).Values
                                                 .Where(IsExecuteNoLite)
                                                 .CommaOr(o => o.OperationSymbol.Key)));
     }
 }
예제 #2
0
파일: Common.cs 프로젝트: sizzles/framework
        public static void TaskSetValueProperty(FrameworkElement fe, string route, PropertyRoute context)
        {
            DependencyProperty valueProperty = ValuePropertySelector.GetValue(fe.GetType());

            bool isReadOnly = context.PropertyRouteType == PropertyRouteType.FieldOrProperty && context.PropertyInfo.IsReadOnly() ||
                              context.PropertyRouteType == PropertyRouteType.Mixin;

            if (!BindingOperations.IsDataBound(fe, valueProperty))
            {
                Binding b = new Binding(route)
                {
                    Mode = isReadOnly ? BindingMode.OneWay : BindingMode.TwoWay,
                    NotifyOnValidationError = true,
                    ValidatesOnExceptions   = true,
                    ValidatesOnDataErrors   = true,
                };
                fe.SetBinding(valueProperty, b);
            }
        }
예제 #3
0
 public static Type Type(Type entityType)
 {
     return(PrimaryKeyType.GetValue(entityType));
 }
예제 #4
0
        public static IPropertyValidator?TryGetPropertyValidator(Type type, string property)
        {
            GenerateType(type);

            return(validators.GetValue(type).TryGetC(property));
        }
예제 #5
0
        private Expression BuildExtension(Type parentType, string key, Expression parentExpression)
        {
            LambdaExpression lambda = RegisteredExtensions.GetValue(parentType)[key].Lambda;

            return(ExpressionReplacer.Replace(Expression.Invoke(lambda, parentExpression)));
        }