Conversation started May 7, 2021 at 13:21.
May 7, 2021 13:21
Hi, I don't know if it is bug or i am doing anything wrong but Encapculate field refactoring is not working for some cases. Like in the image it is not showing any property. I am using the latest version which was released four days ago. in previous version it was working.
Did someone notice this type of unusual things ? Or am i doing something wrong?
Just to clarify - in the screenshot there are no fields. So the refactoring has nothing to select from. Were there fields originally?
Private This as TunitPrice>> this is the field
yes but the point of the refactoring is to convert Private Foo As String into a property; there are none and the This field is not considered, I think
The UDT variable is (correctly) being picked up as the UDT backing structure, as such it makes no sense to... make the UDT recursive?
The issue here is that I think you want to expose the member of UDT as a property, right?
May 7, 2021 13:32
Oh - yeah that's not a use case that was considered
in which case Encapsulate field refactor feels funny - it's not meant to do that, I think.
The refactoring does not allow exposing a Private UDT on a Class.
Neither does the compiler FWIW
Exactly
The refactoring will generate Properties for all the UDT members
Actually i was using this encapculate field option to get all the property let and get method for each of the member of the UDT.
May 7, 2021 13:34
See, I think that's the confusing thing. When we encapuslate the fields into a UDT, we get properties.
but in this case, we already have an UDT, but we want to extract properties out of it.
Hm you worked too hard - just declare a bunch of public fields, the refactoring takes care of everything else
why shouldn't I be able to write a UDT and ask the ducky to make me some properties from that?
So i need to declare the variable under UDT and then if i use encapculate then it will generate all the property for me. and i can get all the property and then i delete those which is not necessary.
@MDIsmailHosen Right now, yes.
@this you should, but I don't think it works that way atm
May 7, 2021 13:36
@MDIsmailHosen I was able to re-create your scenario. If you close the EF and re-open it, the properties (in my case) are provided.
Yes, I think what we really want to do is split the encapsulate field and extract property
@BZngr hm sounds like a bug?
@this ooh yes!
so that each can be a refactoring action but when we handle the former, we can do the latter automatically.
Like this one is working
It is generating all the property for that UDT members.
 
Conversation ended May 7, 2021 at 13:37.