/// <summary>
        /// Guesses the scope for found.
        /// </summary>
        /// <param name="targetPropertyType">Type of the target property.</param>
        /// <param name="found">The found.</param>
        private void GuessScopeForFound(Type targetPropertyType, CrosswalkScope found)
        {
            var        tempObj = found.SourceValue ?? 0;
            var        temp    = ElementMappingModel.GuardValueOnType(tempObj, targetPropertyType);
            ScopeValue result;

            if (temp == null)
            {
                result = default(ScopeValue);
            }
            else
            {
                using (var sess = SessionFactory.OpenSession())
                {
                    result = sess.Query <ScopeValue>()
                             .Where(value => value.Owner.Id == Element.Scope.Id)
                             .ToList()
                             .FirstOrDefault(v =>
                    {
                        var test = targetPropertyType.IsEnum
                                                        ? Enum.ToObject(targetPropertyType, v.Value)
                                                        : v.Value;
                        var areEq = Equals(test, temp);
                        return(areEq);
                    });
                }
            }

            found.ScopeValue = result;
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CrosswalkViewModel"/> class.
        /// </summary>
        /// <param name="crossWalk">The cross walk.</param>
        public CrosswalkViewModel(CrosswalkScope crossWalk)
        {
            Crosswalk = crossWalk;
            var dispPropChange = crossWalk as INotifyPropertyChanged;

            dispPropChange.PropertyChanged += (o, e) => OnPropertyChanged();
            OnPropertyChanged();
        }