예제 #1
0
        /// <summary>
        /// 字符串列表解析为属性
        /// </summary>
        /// <param name="items"></param>
        /// <returns></returns>
        public override IdGeoCoord Parse(string[] items)
        {
            var    name   = items[PropertyIndexes[VariableNames.Id]];
            double lon    = Double.Parse(items[PropertyIndexes[VariableNames.Lon]]);
            double lat    = Double.Parse(items[PropertyIndexes[VariableNames.Lat]]);
            double height = 0;

            if (PropertyIndexes.ContainsKey(VariableNames.Height) && items.Length > PropertyIndexes[VariableNames.Height])
            {
                height = Double.Parse(items[PropertyIndexes[VariableNames.Height]]);
            }

            var coord = new GeoCoord(lon, lat, height);

            if (this.IsPropertyUnitChanged)
            {
                coord.Lon    = Convert(VariableNames.Lon, coord.Lon);
                coord.Lat    = Convert(VariableNames.Lat, coord.Lat);
                coord.Height = Convert(VariableNames.Height, coord.Height);
            }

            return(new IdGeoCoord(name, coord));
        }
예제 #2
0
    /// <summary>
    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
    ///     any release. You should only use it directly in your code with extreme caution and knowing that
    ///     doing so can result in application failures when updating to a new Entity Framework Core release.
    /// </summary>
    public static PropertyCounts CalculateCounts(this IRuntimeEntityType entityType)
    {
        var index                = 0;
        var navigationIndex      = 0;
        var originalValueIndex   = 0;
        var shadowIndex          = 0;
        var relationshipIndex    = 0;
        var storeGenerationIndex = 0;

        var baseCounts = entityType.BaseType?.GetCounts();

        if (baseCounts != null)
        {
            index                = baseCounts.PropertyCount;
            navigationIndex      = baseCounts.NavigationCount;
            originalValueIndex   = baseCounts.OriginalValueCount;
            shadowIndex          = baseCounts.ShadowCount;
            relationshipIndex    = baseCounts.RelationshipCount;
            storeGenerationIndex = baseCounts.StoreGeneratedCount;
        }

        foreach (var property in entityType.GetDeclaredProperties())
        {
            var indexes = new PropertyIndexes(
                index: index++,
                originalValueIndex: property.RequiresOriginalValue() ? originalValueIndex++ : -1,
                shadowIndex: property.IsShadowProperty() ? shadowIndex++ : -1,
                relationshipIndex: property.IsKey() || property.IsForeignKey() ? relationshipIndex++ : -1,
                storeGenerationIndex: property.MayBeStoreGenerated() ? storeGenerationIndex++ : -1);

            ((IRuntimePropertyBase)property).PropertyIndexes = indexes;
        }

        var isNotifying = entityType.GetChangeTrackingStrategy() != ChangeTrackingStrategy.Snapshot;

        foreach (var navigation in entityType.GetDeclaredNavigations()
                 .Union <IPropertyBase>(entityType.GetDeclaredSkipNavigations()))
        {
            var indexes = new PropertyIndexes(
                index: navigationIndex++,
                originalValueIndex: -1,
                shadowIndex: navigation.IsShadowProperty() ? shadowIndex++ : -1,
                relationshipIndex: ((IReadOnlyNavigationBase)navigation).IsCollection && isNotifying ? -1 : relationshipIndex++,
                storeGenerationIndex: -1);

            ((IRuntimePropertyBase)navigation).PropertyIndexes = indexes;
        }

        foreach (var serviceProperty in entityType.GetDeclaredServiceProperties())
        {
            var indexes = new PropertyIndexes(
                index: -1,
                originalValueIndex: -1,
                shadowIndex: -1,
                relationshipIndex: -1,
                storeGenerationIndex: -1);

            ((IRuntimePropertyBase)serviceProperty).PropertyIndexes = indexes;
        }

        return(new PropertyCounts(
                   index,
                   navigationIndex,
                   originalValueIndex,
                   shadowIndex,
                   relationshipIndex,
                   storeGenerationIndex));
    }
예제 #3
0
 public Series RenumberProperties(ItemProperties newItemProperties, IList <int> newNumbering)
 {
     return(new Series(newItemProperties, SeriesId, SeriesCaption, PropertyIndexes.Select(i => newNumbering[i]), PropertyType));
 }