Implement IDisposable on LINQ to SQL Partial Entity Classes
I'm extending LINQ to SQL entity classes with partial classes, and I'm wondering how best to reset some properties of entity objects to their default state.
My partial classes don't use unmanaged resources. And as far as I can tell; See also LINQ to SQL class classes. So I think I am implementing IDisposable
and handling property reset internally Dispose()
.
- What are your thoughts on this approach?
- And would you set a value
null
or something else before the specified properties ?
a source to share
For better or worse, it is IDisposable
almost universally associated with resource finishing rather than reselling. This sounds strange to me. I would just create a method Reset()
- or just create a new instance whenever you need to. What is the purpose of this? What are you trying to achieve?
As for "suppressing [instance] instance on GC" - what exactly do you mean? If you are talking about a finalizer, I would think very carefully before adding a finalizer - this is very rarely the right way to go.
a source to share