Ejemplo n.º 1
0
        internal virtual FacetValues ToFacetValues()
        {
            FacetValues facetValues = new FacetValues();

            if (this.DefaultValue != null)
            {
                facetValues.DefaultValue = this.DefaultValue;
            }
            if (this.IsFixedLength.HasValue)
            {
                facetValues.FixedLength = (FacetValueContainer <bool?>) new bool?(this.IsFixedLength.Value);
            }
            if (this.IsUnicode.HasValue)
            {
                facetValues.Unicode = (FacetValueContainer <bool?>) new bool?(this.IsUnicode.Value);
            }
            if (this.MaxLength.HasValue)
            {
                facetValues.MaxLength = (FacetValueContainer <int?>) new int?(this.MaxLength.Value);
            }
            byte?precision = this.Precision;

            if ((precision.HasValue ? new int?((int)precision.GetValueOrDefault()) : new int?()).HasValue)
            {
                facetValues.Precision = (FacetValueContainer <byte?>) new byte?(this.Precision.Value);
            }
            byte?scale = this.Scale;

            if ((scale.HasValue ? new int?((int)scale.GetValueOrDefault()) : new int?()).HasValue)
            {
                facetValues.Scale = (FacetValueContainer <byte?>) new byte?(this.Scale.Value);
            }
            return(facetValues);
        }
Ejemplo n.º 2
0
        private static TypeUsage CreateType(PrimitiveTypeKind type, FacetValues facets)
        {
            var primitiveType = EdmProviderManifest.Instance.GetPrimitiveType(type);
            var typeUsage     = TypeUsage.Create(primitiveType, facets);

            return(typeUsage);
        }
        public void ToFacetValues_returns_specified_facet_values()
        {
            var columnModel = new ColumnModel(PrimitiveTypeKind.Boolean)
            {
                DefaultValue = 0.1,
                IsFixedLength = true,
                IsIdentity = true,
                IsNullable = true,
                IsUnicode = true,
                MaxLength = 64,
                Precision = 5,
                Scale = 3
            };

            var expectedFacetValues = new FacetValues()
            {
                DefaultValue = 0.1,
                FixedLength = true,
                StoreGeneratedPattern = StoreGeneratedPattern.Identity,
                Nullable = true,
                Unicode = true,
                MaxLength = (int?)64,
                Precision = (byte?)5,
                Scale = (byte?)3
            };

            Assert.True(FacetValuesHelpers.Equal<double>(expectedFacetValues, columnModel.ToFacetValues()));
        }
Ejemplo n.º 4
0
        internal override FacetValues ToFacetValues()
        {
            FacetValues facetValues = base.ToFacetValues();

            if (this.IsNullable.HasValue)
            {
                facetValues.Nullable = (FacetValueContainer <bool?>) new bool?(this.IsNullable.Value);
            }
            if (this.IsIdentity)
            {
                facetValues.StoreGeneratedPattern = (FacetValueContainer <StoreGeneratedPattern?>) new StoreGeneratedPattern?(StoreGeneratedPattern.Identity);
            }
            return(facetValues);
        }
        private FacetValues ReadBitSetsForValues(string facetAttributeFieldName)
        {
            var facetValues = new FacetValues {
                Term = facetAttributeFieldName
            };

            facetValues.FacetValueBitSetList.AddRange(GetFacetValueTerms(facetAttributeFieldName).OrderByDescending(x => x.Count));

            if (FacetSearcherConfiguration.MemoryOptimizer == null)
            {
                return(facetValues);
            }
            foreach (var facetValue in FacetSearcherConfiguration.MemoryOptimizer.SetAsLazyLoad(_facetBitSetDictionary.Values.ToList()))
            {
                facetValue.Bitset = null;
            }

            return(facetValues);
        }
Ejemplo n.º 6
0
        internal virtual FacetValues ToFacetValues()
        {
            var facets = new FacetValues();

            if (DefaultValue != null)
            {
                facets.DefaultValue = DefaultValue;
            }

            if (IsFixedLength != null)
            {
                facets.FixedLength = IsFixedLength.Value;
            }

            if (IsUnicode != null)
            {
                facets.Unicode = IsUnicode.Value;
            }

            if (MaxLength != null)
            {
                facets.MaxLength = MaxLength.Value;
            }

            if (Precision != null)
            {
                facets.Precision = Precision.Value;
            }

            if (Scale != null)
            {
                facets.Scale = Scale.Value;
            }

            return(facets);
        }
        private FacetValues ReadBitSetsForValues(string facetAttributeFieldName)
        {
            var facetValues = new FacetValues {Term = facetAttributeFieldName};

            facetValues.FacetValueBitSetList.AddRange(GetFacetValueTerms(facetAttributeFieldName).OrderByDescending(x => x.Count));

            if (FacetSearcherConfiguration.MemoryOptimizer == null) return facetValues;
            foreach (var facetValue in FacetSearcherConfiguration.MemoryOptimizer.SetAsLazyLoad(_facetBitSetDictionary.Values.ToList()))
                facetValue.Bitset = null;

            return facetValues;
        }
 private static TypeUsage CreateType(PrimitiveTypeKind type, FacetValues facets)
 {
     return(TypeUsage.Create((EdmType)EdmProviderManifest.Instance.GetPrimitiveType(type), facets));
 }