Single type argument version of Tag
See original GitHub issueThe current API provides two versions of Tag
.
Tag
Tag<M,T>
This issue suggests that we add a third type that takes a guess at which Mapper class to use based on a single type argument for the CLR type to use. i.e.
Tag<T>
Some discussions where this was discussed:
- https://github.com/libplctag/libplctag.NET/issues/28#issuecomment-653854167
- https://github.com/libplctag/libplctag.NET/issues/153
What needs to be decided?
- What should the mappings be between CLR type and Mapper types.
Issue Analytics
- State:
- Created 3 years ago
- Comments:23 (10 by maintainers)
Top Results From Across the Web
Allow multiple tag arguments in selectors, like @a[tag=hi ...
So I propose that selector arguments evaluate their arguments using proper logical AND and not just lazy limitation of 1 argument type per ......
Read more >Using a generic type argument in place of an ...
to non generic version (otherwise some arguments will be generic type arguments, and some will be regular arguments).
Read more >Git - git-tag Documentation
Running "git tag" without arguments also lists all tags. ... Also supports "version:refname" or "v:refname" (tag names are treated as versions).
Read more >Patch 2016 xparse to support k-type argument
If I have a single (patched) version of xparse that supports both argument types, the transition will be a lot easier.
Read more >Recommended XML tags for C# documentation comments
This article provides the syntax and definitions for recommended tags for XML documentation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I took a quick spin through it, but your other comment jogged my memory.
If we only specify the CLR type, how do we know what the PLC type is to create the tag? (Since they aren’t 1-to-1). Or can we actually get by without knowing that?
Other than that, in terms of implementation I was thinking of using a dictionary or even a factory-pattern to get the mapper. That has the benefit of getting the case structure out of the class and allowing for runtime changes (adding custom mappers) with the trade-off of increased complexity. If we didn’t want to DI the lookup, then we’d have to make it a static. That being said, defining it in code is more or less a static anyway.
The other route would be to go toward an actual factory-pattern for tags. I end up implementing that in my local code anyway. Create a
TagFactory
and set PLC path/params/etc and then just use it to instantiate tags with aType
andName
. Each factory instance could hold an instance of the lookup that it uses to DI. At that point, we could just pass the proper mapper to theTag
and take that concern away from theTag
class. Thoughts?Please don’t necro threads. This question has nothing to do with this discussion.
Post questions to libplctag forum or open another issue with your question. https://github.com/libplctag/libplctag#libplctag-forum