Esempio n. 1
0
        internal static Constant GetDefaultValueForMemberPath(
            MemberPath memberPath, IEnumerable <LeftCellWrapper> wrappersForErrorReporting,
            ConfigViewGenerator config)
        {
            Constant defaultValue = null;

            if (!TryGetDefaultValueForMemberPath(memberPath, out defaultValue))
            {
                var message = Strings.ViewGen_No_Default_Value(memberPath.Extent.Name, memberPath.PathToString(false));
                var record  = new ErrorLog.Record(ViewGenErrorCode.NoDefaultValue, message, wrappersForErrorReporting, String.Empty);
                ExceptionHelpers.ThrowMappingException(record, config);
            }
            return(defaultValue);
        }
Esempio n. 2
0
        internal static Constant GetDefaultValueForMemberPath(
            MemberPath memberPath,
            IEnumerable <LeftCellWrapper> wrappersForErrorReporting,
            ConfigViewGenerator config)
        {
            Constant defaultConstant = (Constant)null;

            if (!Domain.TryGetDefaultValueForMemberPath(memberPath, out defaultConstant))
            {
                ExceptionHelpers.ThrowMappingException(new ErrorLog.Record(ViewGenErrorCode.NoDefaultValue, Strings.ViewGen_No_Default_Value((object)memberPath.Extent.Name, (object)memberPath.PathToString(new bool?(false))), wrappersForErrorReporting, string.Empty), config);
            }
            return(defaultConstant);
        }
 internal string ToUserString()
 {
     return(m_memberPath.PathToString(false));
 }
        internal MemberDomainMap(
            ViewTarget viewTarget,
            bool isValidationEnabled,
            IEnumerable <Cell> extentCells,
            EdmItemCollection edmItemCollection,
            ConfigViewGenerator config,
            Dictionary <EntityType, Set <EntityType> > inheritanceGraph)
        {
            this.m_conditionDomainMap = new Dictionary <MemberPath, Set <Constant> >(MemberPath.EqualityComparer);
            this.m_edmItemCollection  = edmItemCollection;
            Dictionary <MemberPath, Set <Constant> > dictionary = viewTarget != ViewTarget.UpdateView ? Domain.ComputeConstantDomainSetsForSlotsInQueryViews(extentCells, this.m_edmItemCollection, isValidationEnabled) : Domain.ComputeConstantDomainSetsForSlotsInUpdateViews(extentCells, this.m_edmItemCollection);

            foreach (Cell extentCell in extentCells)
            {
                foreach (MemberRestriction memberRestriction in extentCell.GetLeftQuery(viewTarget).GetConjunctsFromWhereClause())
                {
                    MemberPath     memberPath = memberRestriction.RestrictedMemberSlot.MemberPath;
                    Set <Constant> set;
                    if (!dictionary.TryGetValue(memberPath, out set))
                    {
                        set = Domain.DeriveDomainFromMemberPath(memberPath, edmItemCollection, isValidationEnabled);
                    }
                    if (set.Contains(Constant.Null) || !memberRestriction.Domain.Values.All <Constant>((Func <Constant, bool>)(conditionConstant => conditionConstant.Equals((object)Constant.NotNull))))
                    {
                        if (set.Count <= 0 || !set.Contains(Constant.Null) && memberRestriction.Domain.Values.Contains <Constant>(Constant.Null))
                        {
                            ExceptionHelpers.ThrowMappingException(new ErrorLog.Record(ViewGenErrorCode.InvalidCondition, Strings.ViewGen_InvalidCondition((object)memberPath.PathToString(new bool?(false))), extentCell, string.Empty), config);
                        }
                        if (!memberPath.IsAlwaysDefined(inheritanceGraph))
                        {
                            set.Add(Constant.Undefined);
                        }
                        this.AddToDomainMap(memberPath, (IEnumerable <Constant>)set);
                    }
                }
            }
            this.m_nonConditionDomainMap = new Dictionary <MemberPath, Set <Constant> >(MemberPath.EqualityComparer);
            foreach (Cell extentCell in extentCells)
            {
                foreach (MemberProjectedSlot allQuerySlot in extentCell.GetLeftQuery(viewTarget).GetAllQuerySlots())
                {
                    MemberPath memberPath = allQuerySlot.MemberPath;
                    if (!this.m_conditionDomainMap.ContainsKey(memberPath) && !this.m_nonConditionDomainMap.ContainsKey(memberPath))
                    {
                        Set <Constant> set = Domain.DeriveDomainFromMemberPath(memberPath, this.m_edmItemCollection, true);
                        if (!memberPath.IsAlwaysDefined(inheritanceGraph))
                        {
                            set.Add(Constant.Undefined);
                        }
                        Set <Constant> iconstants = Domain.ExpandNegationsInDomain((IEnumerable <Constant>)set, (IEnumerable <Constant>)set);
                        this.m_nonConditionDomainMap.Add(memberPath, (Set <Constant>) new MemberDomainMap.CellConstantSetInfo(iconstants));
                    }
                }
            }
        }