[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/job/ - Job Board

Freelance opportunities, career advice & skill development
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1776876186010.jpg (145.69 KB, 1080x608, img_1776876178351_pc1pzx24.jpg)ImgOps Exif Google Yandex

1dad2 No.1539

figma '''s docs might make it simpler if you actually read them
>just use the default settings bronope customize everything

i was struggling to implement this until i found a solution. basically, instead of just adding an isdeleted flag and calling it quits:

- '''default queries: set up global filters in your context class so deleted rows don't show by defualt
>

- '''write path: use a custom entity state to handle deletes as updates. this way, you can maintain your data integrity


- '''unique constraints: make sure your indexes ignore soft-deletions. you can do this by adding a filter in the index definition
builder. Entity<MyEntity>(). HasIndex(e => e. MyProperty) // add an include/exclude for deleted entities here. ;


and finally,restore path: implement logic to undelete items w/o breaking your current mode. you can do this by adding a restore method in the entity class or via custom queries
public void Restore(int id) { var item = _context. MyEntities. Find(id); if (item!= null &&! item. IsDeleted) { // set isdeleted flag to false and save. }}


it's a bit of work, but once you get the hang of it, soft delete w/ filtered indexes can be pretty powerful. have any other tips or struggles implementing this?

https://dev.to/imzihad21/implementing-soft-delete-with-filtered-indexes-in-entity-framework-core-49ip

1dad2 No.1540

File: 1776876278244.jpg (266.99 KB, 1280x853, img_1776876264090_n9v47n2p.jpg)ImgOps Exif Google Yandex

>>1539
twice before u implement complex solutions when a simple soft delete flag will do



[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]
. "http://www.w3.org/TR/html4/strict.dtd">