Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Data.SqlClient;
using System.Linq;
using System.Linq.Expressions;
using System.ComponentModel.DataAnnotations.Schema;

namespace EntityFramework.Utilities
{
Expand Down Expand Up @@ -116,6 +117,7 @@ public void InsertAll<TEntity>(IEnumerable<TEntity> items, DbConnection connecti

var properties = tableMapping.PropertyMappings
.Where(p => currentType.IsSubclassOf(p.ForEntityType) || p.ForEntityType == currentType)
.Where(p => p.IsComputed == false)
.Select(p => new ColumnMapping { NameInDatabase = p.ColumnName, NameOnObject = p.PropertyName }).ToList();
if (tableMapping.TPHConfiguration != null)
{
Expand Down Expand Up @@ -157,6 +159,7 @@ public void UpdateAll<TEntity>(IEnumerable<TEntity> items, Action<UpdateSpecific

var properties = tableMapping.PropertyMappings
.Where(p => currentType.IsSubclassOf(p.ForEntityType) || p.ForEntityType == currentType)
.Where(p => p.IsComputed == false)
.Select(p => new ColumnMapping {
NameInDatabase = p.ColumnName,
NameOnObject = p.PropertyName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public class PropertyMapping
public bool IsPrimaryKey { get; set; }

public string DataTypeFull { get; set; }
public bool IsComputed { get; set; }
}

/// <summary>
Expand Down Expand Up @@ -155,7 +156,7 @@ public EfMapping(DbContext db)
tableMapping.Schema = mappingToLookAt.Fragments[0].StoreEntitySet.Schema;
tableMapping.TableName = mappingToLookAt.Fragments[0].StoreEntitySet.Table ?? mappingToLookAt.Fragments[0].StoreEntitySet.Name;
typeMapping.TableMappings.Add(tableMapping);

Action<Type, System.Data.Entity.Core.Mapping.PropertyMapping, string> recurse = null;
recurse = (t, item, path) =>
{
Expand All @@ -176,7 +177,8 @@ public EfMapping(DbContext db)
DataType = scalar.Column.TypeName,
DataTypeFull = GetFullTypeName(scalar),
PropertyName = path + item.Property.Name,
ForEntityType = t
ForEntityType = t,
IsComputed = scalar.Column.IsStoreGeneratedComputed
});
}
};
Expand Down