2011-11-09 3 views
0

MySQL Connector/NET 6.4.4에서 Entity Framework를 사용하여 행을 삽입하는 데 문제가 있습니다. 나는 "첫 번째 코드"로 EF 4.1을 사용하고Entity Framework에서 MySQL을 사용할 때의 문제

at MySql.Data.Entity.SqlGenerator.GenerateReturningSql(DbModificationCommandTree tree, DbExpression returning) 
at MySql.Data.Entity.UpdateGenerator.GenerateSQL(DbCommandTree tree) 
at MySql.Data.MySqlClient.MySqlProviderServices.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree) 
at System.Data.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree commandTree) 
at System.Data.Common.DbProviderServices.CreateCommand(DbCommandTree commandTree) 
at System.Data.Mapping.Update.Internal.UpdateTranslator.CreateCommand(DbModificationCommandTree commandTree) 
at System.Data.Mapping.Update.Internal.DynamicUpdateCommand.CreateCommand(UpdateTranslator translator, Dictionary`2 identifierValues) 
at System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator translator, EntityConnection connection, Dictionary`2 identifierValues, List`1 generatedValues) 
at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter) 
at System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache) 
at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options) 
at System.Data.Entity.Internal.InternalContext.SaveChanges() 
at System.Data.Entity.Internal.LazyInternalContext.SaveChanges() 
at System.Data.Entity.DbContext.SaveChanges() 
at UserData.Repository.DBRepositoryDataContext.SaveChanges() in C:\SoftwareProjects\Java\Degoo\Server\UserData\Repository\DBRepositoryDataContext.cs:line 42 
at UserData.Repository.Repository.<SaveChanges>b__1() in C:\SoftwareProjects\Java\Degoo\Server\UserData\Repository\Repository.cs:line 137 
at Microsoft.AppFabricCAT.Samples.Azure.TransientFaultHandling.RetryPolicy`1.ExecuteAction(Action action) in C:\SoftwareProjects\Java\Degoo\Server\Libraries\TransientFaultHandlingFramework\RetryPolicy.cs:line 352 

: 나는 1 개 행을 추가 한 후 변경 내용을 저장하려고하면 나는 다음과 같은 스택 추적과 함께 System.NullReferenceException를 얻을. 다른 말로하면 : 나는 DbSet과 DbContext를 사용합니다. 이 원인을 무엇에

 System.Data.Entity.Infrastructure.DbEntityEntry<Utilities.IStandardEntity> 
_internalEntityEntry System.Data.Entity.Internal.InternalEntityEntry 
CurrentValues  System.Data.Entity.Infrastructure.DbPropertyValues 
Entity  UserData.PerformanceCounterEntities.PerformanceCounterEntity 
CallingClassName "com.degoo.tests.integration.PerformanceCounterUploaderTest" string 
Category {System.Data.Entity.DynamicProxies.TextEntity_27BF3732ED645CE792F48B4AA75BFD05C10C0AE9C5B35779176C02A53A587F1A} UserData.PerformanceCounterEntities.TextEntity {System.Data.Entity.DynamicProxies.TextEntity_27BF3732ED645CE792F48B4AA75BFD05C10C0AE9C5B35779176C02A53A587F1A} 
CategoryTextID 1 long 
CreationTime {2011-11-09 09:32:12} System.DateTime 
Description {System.Data.Entity.DynamicProxies.TextEntity_27BF3732ED645CE792F48B4AA75BFD05C10C0AE9C5B35779176C02A53A587F1A} UserData.PerformanceCounterEntities.TextEntity {System.Data.Entity.DynamicProxies.TextEntity_27BF3732ED645CE792F48B4AA75BFD05C10C0AE9C5B35779176C02A53A587F1A} 
DescriptionTextID 3 long 
ID 0 long 
ModificationTime {2011-11-09 09:32:12} System.DateTime 
Name {System.Data.Entity.DynamicProxies.TextEntity_27BF3732ED645CE792F48B4AA75BFD05C10C0AE9C5B35779176C02A53A587F1A} UserData.PerformanceCounterEntities.TextEntity {System.Data.Entity.DynamicProxies.TextEntity_27BF3732ED645CE792F48B4AA75BFD05C10C0AE9C5B35779176C02A53A587F1A} 
NameTextID 2 long 
NodeID 16485 long 
NumberOfSamples 1 long 
RowVersion 0 long 
Value 1.0 double 

어떤 아이디어 :

이것은 내가 EF의 변화 추적기에 같은 외모를 추가하기 위해 노력하고있어 어떤 기업인가? 그것은 MySQL의 EF 드라이버의 버그처럼 보입니다 (최소한 더 나은 오류 메시지를 제공하기 위해 업데이트해야합니다).

+2

상업 제공/드라이버 옵션이 Devart에서 하나를 시도하는 경우 - EF (http://www.devart.com/dotconnect/mysql/)로 정말 멋지다 ... (단지 행복한 고객, 제휴사가 아님) – Yahia

답변

1

동일한 커넥터 드라이버를 사용하여 비슷한 문제가 발생했습니다. 내 경우에는 객체 중 하나가 속성 대신 속성을 사용하고있었습니다. 대신

public class User : ProjectBasicEntity 
{ 
    public string SomeColumn { get; set;} 
} 

public class User : ProjectBasicEntity 
{ 
    public string SomeColumn; 
} 

나는 사람이 정말 그 드라이버에 오류 처리를 개선 할 필요가 생각 ...

관련 문제