Skip to content

Instantly share code, notes, and snippets.

@ianChen806
ianChen806 / update.cs
Created August 18, 2022 02:48
ef update without select
// ef
[Fact]
public async Task Test()
{
var agent = new Agent()
{
Id = 9,
Name = "new2"
};
_db.Agents.Attach(agent);
@ianChen806
ianChen806 / CreateGenericTypeInstance.cs
Last active July 14, 2022 07:12
create generic type instance
Type[] type = { typeof(string) };
var genericType = typeof(List<>).MakeGenericType(type);
var instance = Activator.CreateInstance(genericType);