예제 #1
0
        //partial void RunCustomLogicAfterInsert(ref entCSC.City newDBItem, ref IRepositoryActionResult<entCSC.City> result) {}

        //partial void RunCustomLogicAfterUpdatePatch(ref entCSC.City updatedDBItem, ref IRepositoryActionResult<entCSC.City> result) {}

        partial void RunCustomLogicAfterUpdatePut(ref entCSC.City updatedDBItem, ref IRepositoryActionResult <entCSC.City> result)
        {
            if (result.Status == Enums.RepositoryActionStatus.NotFound)
            {                   // An update/PUT was attempted when it should have been a create/POST.
                var localDBItem  = updatedDBItem;
                var insertResult = RunSync <IRepositoryActionResult <entCSC.City> >(() => Repo.InsertAsync(localDBItem));
                if (insertResult.Status == Enums.RepositoryActionStatus.Created)
                {                   // Insert worked
                    result = new RepositoryActionResult <entCSC.City>(insertResult.Entity, Enums.RepositoryActionStatus.Updated);
                }
            }
        }
 partial void RunCustomLogicOnGetEntityByPK(ref entCSC.City dbItem, Guid cityId, int numChildLevels);
 partial void RunCustomLogicBeforeUpdatePut(ref entCSC.City updatedDBItem, Guid cityId);
 partial void RunCustomLogicAfterUpdatePut(ref entCSC.City updatedDBItem, ref IRepositoryActionResult <entCSC.City> result);
 partial void RunCustomLogicAfterInsert(ref entCSC.City newDBItem, ref IRepositoryActionResult <entCSC.City> result);