When I tried to insert value on it I got System.InvalidOperationException.
Please tell me what I do wrong. Thanks.
table:
entity:CREATE TABLE [trigger] (
[id] integer PRIMARY KEY AUTOINCREMENT NOT NULL,
[name] text NOT NULL )
Code: Select all
[Table(Name = @"trigger")]
public partial class Trigger : INotifyPropertyChanging, INotifyPropertyChanged {
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private long _Id;
private string _Name;
#region Extensibility Method Definitions
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnIdChanging(long value);
partial void OnIdChanged();
partial void OnNameChanging(string value);
partial void OnNameChanged();
#endregion
public Trigger()
{
OnCreated();
}
[Column(Name = @"id", Storage = "_Id", CanBeNull = false, DbType = "integer NOT NULL", IsDbGenerated = true, IsPrimaryKey = true)]
public long Id
{
get
{
return this._Id;
}
set
{
if (this._Id != value)
{
this.OnIdChanging(value);
this.SendPropertyChanging();
this._Id = value;
this.SendPropertyChanged("Id");
this.OnIdChanged();
}
}
}
[Column(Name = @"name", Storage = "_Name", CanBeNull = false, DbType = "text NOT NULL")]
public string Name
{
get
{
return this._Name;
}
set
{
if (this._Name != value)
{
this.OnNameChanging(value);
this.SendPropertyChanging();
this._Name = value;
this.SendPropertyChanged("Name");
this.OnNameChanged();
}
}
}
}
}
Code: Select all
using (var connector = new StorageConnector(connString))
{
var trigger = new Trigger
{
Name = "test"
};
connector.Triggers.InsertOnSubmit(trigger);
connector.SubmitChanges();
}
System.InvalidOperationException: Cannot refresh Entity. Record does not exist.
at Devart.Data.SQLite.Linq.Provider.SQLiteDataProvider.GetAutoSyncValues(MetaType type, IDbCommand dbCommand, IList`1 autoSyncFields, IList`1 autoSyncParameters, IList`1 keyFields, IList`1 keyParameters)
at Devart.Data.Linq.v.b(MetaType A_0, q A_1, Boolean A_2)
at Devart.Data.Linq.f.a(b A_0, Object A_1, ModifiedMemberInfo[] A_2, Boolean A_3)
at Devart.Data.Linq.k.a(DataContext A_0, ConflictMode A_1)
at Devart.Data.Linq.k.b(DataContext A_0, ConflictMode A_1)
at Devart.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
at Devart.Data.Linq.DataContext.SubmitChanges()
at StorageConnector.SubmitChanges() in line 16