ApathyErr
ApathyErr
CC#
Created by ApathyErr on 6/18/2024 in #help
QuestPDF Why does the document become empty after adding the table and how to fix it?
2 replies
CC#
Created by ApathyErr on 4/9/2024 in #help
Why can't I use the null propagation operator in lambda expressions?
How else can I fix it then?
10 replies
CC#
Created by ApathyErr on 4/9/2024 in #help
Why can't I use the null propagation operator in lambda expressions?
CS8072 - An expression tree lambda may not contain a null propagating operator.
10 replies
CC#
Created by ApathyErr on 4/6/2024 in #help
DataGridComboBoxColumn
.
3 replies
CC#
Created by ApathyErr on 4/6/2024 in #help
DataGridComboBoxColumn
No description
3 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
thx again <3
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
No description
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
As soon as I overwritten the database so that the id was not empty, the code started working. But because my program displayed records with Completed = 1, and I created records where Completed = 0, so I thought they were not being created
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
I have banned an empty id. Do you think it's better to prohibit creating rows in which most of the columns are empty?
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
I overwritten the database and reconnected it to the program
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
these are the very records that I added. Then it turns out that the problem is already with displaying them in the program
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
No description
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
public partial class ProfitCalculatorDataBaseContext : DbContext
{
public ProfitCalculatorDataBaseContext()
{
}

public ProfitCalculatorDataBaseContext(DbContextOptions<ProfitCalculatorDataBaseContext> options)
: base(options)
{
}

public virtual DbSet<Order> Orders { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
=> optionsBuilder.UseSqlite("Data Source= E:\\VS Projects\\ProfitCalculator\\ProfitCalculator\\DataBase\\ProfitCalculatorDataBase.db");

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Order>(entity =>
{
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Data).HasColumnName("data");
});

OnModelCreatingPartial(modelBuilder);
}

partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
public partial class ProfitCalculatorDataBaseContext : DbContext
{
public ProfitCalculatorDataBaseContext()
{
}

public ProfitCalculatorDataBaseContext(DbContextOptions<ProfitCalculatorDataBaseContext> options)
: base(options)
{
}

public virtual DbSet<Order> Orders { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
=> optionsBuilder.UseSqlite("Data Source= E:\\VS Projects\\ProfitCalculator\\ProfitCalculator\\DataBase\\ProfitCalculatorDataBase.db");

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Order>(entity =>
{
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Data).HasColumnName("data");
});

OnModelCreatingPartial(modelBuilder);
}

partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
No description
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
modelbuilder?
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
No description
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
db browser
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
I added the auto-generation id, but did not update the context in the program itself. Now I have done it and it has removed this error, but new records are still not saved.
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
sqlite
87 replies
CC#
Created by ApathyErr on 4/5/2024 in #help
✅ WPF. Instance with the same key value for {'Id'} is already being tracked
System.InvalidOperationException: "The instance of entity type 'Order' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values."
System.InvalidOperationException: "The instance of entity type 'Order' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values."
87 replies