Beispiel #1
0
 internal TableExpression([NotNull] ITableBase table)
     : base(table.Name.Substring(0, 1).ToLower())
 {
     Name   = table.Name;
     Schema = table.Schema;
     Table  = table;
 }
Beispiel #2
0
 internal TableExpression(ITableBase table)
     : base(table.Name.Substring(0, 1).ToLowerInvariant())
 {
     Name   = table.Name;
     Schema = table.Schema;
     Table  = table;
 }
 /// <summary>
 ///     Creates a new instance of the <see cref="TemporalTableExpression" /> class representing temporal 'All' operation.
 /// </summary>
 /// <param name="table"> A table source. </param>
 public TemporalTableExpression(ITableBase table)
     : base(table.Name.Substring(0, 1).ToLowerInvariant())
 {
     Name   = table.Name;
     Schema = table.Schema;
     TemporalOperationType = TemporalOperationType.All;
 }
Beispiel #4
0
        private IReadOnlyList <IProperty> GetNonSharedProperties(ITableBase table, IEntityType entityType)
        {
            var nonSharedProperties  = new List <IProperty>();
            var principalEntityTypes = new HashSet <IEntityType>();

            GetPrincipalEntityTypes(table, entityType, principalEntityTypes);
            foreach (var property in entityType.GetProperties())
            {
                if (property.IsPrimaryKey())
                {
                    continue;
                }

                var propertyMappings = table.FindColumn(property).PropertyMappings;
                if (propertyMappings.Count() > 1 &&
                    propertyMappings.Any(pm => principalEntityTypes.Contains(pm.TableMapping.EntityType)))
                {
                    continue;
                }

                nonSharedProperties.Add(property);
            }

            return(nonSharedProperties);
        }
 /// <summary>
 ///     Creates a new instance of the <see cref="TemporalTableExpression" /> class representing temporal 'AsOf' operation.
 /// </summary>
 /// <param name="table"> A table source. </param>
 /// <param name="pointInTime">Point in time. </param>
 public TemporalTableExpression(ITableBase table, DateTime pointInTime)
     : base(table.Name.Substring(0, 1).ToLowerInvariant())
 {
     Name                  = table.Name;
     Schema                = table.Schema;
     PointInTime           = pointInTime;
     TemporalOperationType = TemporalOperationType.AsOf;
 }
Beispiel #6
0
 private void GetPrincipalEntityTypes(ITableBase table, IEntityType entityType, HashSet <IEntityType> entityTypes)
 {
     foreach (var linkingFk in table.GetRowInternalForeignKeys(entityType))
     {
         entityTypes.Add(linkingFk.PrincipalEntityType);
         GetPrincipalEntityTypes(table, linkingFk.PrincipalEntityType, entityTypes);
     }
 }
Beispiel #7
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 TableMappingBase(
     [NotNull] IEntityType entityType,
     [NotNull] ITableBase table,
     bool includesDerivedTypes)
 {
     EntityType           = entityType;
     Table                = table;
     IncludesDerivedTypes = includesDerivedTypes;
 }
 /// <summary>
 ///     Creates a new instance of the <see cref="TemporalTableExpression" /> class representing temporal range operation.
 /// </summary>
 /// <param name="table"> A table source. </param>
 /// <param name="from">Start of the time range.</param>
 /// <param name="to">End of the time range.</param>
 /// <param name="temporalOperationType">Temporal operation type.</param>
 public TemporalTableExpression(ITableBase table, DateTime from, DateTime to, TemporalOperationType temporalOperationType)
     : base(table.Name.Substring(0, 1).ToLowerInvariant())
 {
     Name   = table.Name;
     Schema = table.Schema;
     From   = from;
     To     = to;
     TemporalOperationType = temporalOperationType;
 }
Beispiel #9
0
 private void UpdateMetadataFields(int userId)
 {
     foreach (var ent in DbContext.ChangeTracker.Entries().Where(p => p.State == EntityState.Added || p.State == EntityState.Deleted || p.State == EntityState.Modified))
     {
         if (ent.Entity != null && ent.Entity is ITableBase)
         {
             ITableBase entity = (ITableBase)ent.Entity;
             if (ent.State == EntityState.Added)
             {
                 entity.EnteredBy   = userId;
                 entity.EnteredDate = DateTime.UtcNow;
             }
             entity.LastUpdatedBy = userId;
             entity.LastUpdated   = DateTime.UtcNow;
         }
     }
 }
 internal TableExpression(ITableBase table)
     : this(table, annotations : null)
 {
 }
 /// <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>
 protected TemporalRangeTableExpression(ITableBase table, DateTime from, DateTime to)
     : base(table)
 {
     From = from;
     To   = to;
 }
Beispiel #12
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>
 protected TemporalTableExpression(ITableBase table)
     : base(table.Name[..1].ToLowerInvariant())
Beispiel #13
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 TemporalBetweenTableExpression(ITableBase table, DateTime from, DateTime to)
     : base(table, from, to)
 {
 }
 /// <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 TemporalAllTableExpression(ITableBase table)
     : base(table)
 {
 }
 /// <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 TemporalContainedInTableExpression(ITableBase table, DateTime from, DateTime to)
     : base(table, from, to)
 {
 }
 /// <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 TemporalAsOfTableExpression(ITableBase table, DateTime pointInTime)
     : base(table)
 {
     PointInTime = pointInTime;
 }
Beispiel #17
0
    static public int UsingMethod2(this ITableBase table)
    {
        var i = table.Method2();

        return(i * 5 + 9 - 14 / 3 % 7 /* etc... */);
    }
Beispiel #18
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>
 protected TemporalTableExpression(ITableBase table)
     : base(table.Name.Substring(0, 1).ToLowerInvariant())
 {
     Name   = table.Name;
     Schema = table.Schema;
 }
Beispiel #19
0
 static public void AddingNewMethodToTables(this ITableBase table, string some_string,
                                            int some_int, YourType any_other_parameter /* etc... */)
 {
     // implement the method you want add to all Table classes
 }
Beispiel #20
0
 static public string GetIdAsString(this ITableBase table)
 {
     return(table.Id.ToString());
 }
 private TableExpression(ITableBase table, IEnumerable <IAnnotation>?annotations)
     : base(alias : table.Name[..1].ToLowerInvariant(), annotations)
Beispiel #22
0
 internal TableExpression(ITableBase table)
     : base(table.Name[..1].ToLowerInvariant())
Beispiel #23
0
 public double GetObjectArea(ITableBase tablebase)
 {
     return(tablebase.H * tablebase.W);
 }