-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EDS to/from protobuffer conversion #137
base: main
Are you sure you want to change the base?
Conversation
AutoMapper seems nice solution to me. Probably EDSsharp class will be simplified in some parts, as its sole purpose will be to read and write EDS file. Is that so? |
Yes, but no plan to remove anything in EDSSharp until protobuffer has replaced EDSSharp |
Hi @CANopenNode & @trojanobelix, Need a little help here with the eds access types: Does this look correct?
|
From standard:
I would use (not sure for const):
|
Sorry for the delay, but its now its ready for review not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDSsharp class has a lot of members...
MapToProtobuffer:
In proto definition I used "Alias" instead of "Denotation" (We could change that keyword in proto file). Change "opt.Ignore()" to something like:
.ForMember(dest => dest.Alias, opt => opt.MapFrom(src => src.Denotation))
and
.ForMember(dest => dest.FlagsPDO, opt => src.prop.CO_flagsPDO)
(I also suggest to remove FlagsPDO from CANopen.proto file and use it as non-standard key & value inside it. In another PR)
I don't like that. What if we make a new class, similar to EDSsharp and use inside it only members specified by the standard. It would be much easier to discuss |
Agree, but not sure how its best to solve it, it its very integrated in the gui and all formats. But by all means feel free to change it now if you got the time |
You are right, it is certainly not good idea to remove parts from existing EDSsharp class. One option would be to make new independent class (copy of EDSsharp ?) linked only to this new convertor. But feel free to proceed as you prefer. |
Solution uses AutoMapper that is a mapper solution, not the greatest and newest, but it works on .net framework without to much changes.
It solves mapping by itself if the names and mostly equal and imho one of its best features is that the test will fail if there is something that is not mapped or ignored. So you need to have 100% coverage and if will fail if you add new members/fields that are not mapped.
Going forward i think it is best to make own classes that does the mapping to separate the mapping from other stuff related to the format, so that is why the file and class is named [type]Mapping
Before i convert from draft i need more test