コード例 #1
0
        public async Task SetOwnerAsync(Entity newOwner)
        {
            // Set locally
            Owner_Id = newOwner.Id;

            using (VooperContext context = new VooperContext(VooperContext.DBOptions))
            {
                // Set in DB
                StockObject dummy = new StockObject {
                    Id = this.Id, Owner_Id = Owner_Id
                };
                context.Attach(dummy);
                context.Entry(dummy).Property(x => x.Owner_Id).IsModified = true;

                await context.SaveChangesAsync();
            }
        }