-
Notifications
You must be signed in to change notification settings - Fork 143
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
Optionally support DataContract in Mono/Unity #61
base: master
Are you sure you want to change the base?
Conversation
@@ -31,6 +31,10 @@ | |||
// NOTE: uncomment the following line to enable DataContract support. | |||
//#define SIMPLE_JSON_DATACONTRACT | |||
|
|||
// NOTE: uncomment the following line to use alternate definitions of DataContract/DataMember/IgnoreDataMember. | |||
// define if you want to use DataContract with Mono, which does not implement all WCF classes. | |||
//#define ALTERNATE_DATACONTRACT |
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.
all #define
prefix should be prefixed with SIMPLE_JSON_
. Don't quite like the name alternate too. feel free to give suggestions.
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.
I can think of these possible names:
SIMPLE_JSON_CUSTOM_DATACONTRACT
SIMPLE_JSON_FIX_MISSING_DATACONTRACT
SIMPLE_JSON_REDEFINE_ATTRIBUTES
SIMPLE_JSON_CUSTOM_ATTRIBUTES
SIMPLE_JSON_FIX_MISSING_ATTRIBUTES
SIMPLE_JSON_FIX_MONO_MISSING_ATTRIBUTES
SIMPLE_JSON_NO_WCF
SIMPLE_JSON_FIX_MISSING_DATACONTRACT
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.
SIMPLE_JSON_REDEFINE_DATACONTRACT_ATTRIBUTES
or SIMPLE_JSON_EMBED_DATACONTRACT_ATTRIBUTES
.
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.
I'll vote for SIMPLE_JSON_REDEFINE_DATACONTRACT_ATTRIBUTES
as i think the word "embed" is used when sticking something to the data itself, not classes or attributes, but both are fine.
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.
sure. go for it before I can merge
Did the rename, it's now |
@@ -31,6 +31,10 @@ | |||
// NOTE: uncomment the following line to enable DataContract support. | |||
//#define SIMPLE_JSON_DATACONTRACT | |||
|
|||
// NOTE: uncomment the following line to use alternate definitions of DataContract/DataMember/IgnoreDataMember. | |||
// define if you want to use DataContract with Mono, which does not implement all WCF classes. |
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.
can you add Unity/Mono
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.
Done
|
||
#if SIMPLE_JSON_REDEFINE_DATACONTRACT_ATTRIBUTES | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, Inherited = false, AllowMultiple = false)] | ||
public sealed class DataContractAttribute : Attribute |
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.
add
#if SIMPLE_JSON_INTERNAL
internal
#else
public
#endif
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.
And Done.
so, is this waiting for something from me? i want to make other pull requests, but as I'm new to github, I wanted to do them one by one, as each one is a separate feature, so if there is something that I can do to accelerate this, I'm happy to do, otherwise, how can I make other pull requests? maybe port again? how these things are usually done? |
will try merging and releasing this later tonight. The rule is not to update your master with your patches. This allows you to work on multiple features at the same time. Here is a good workflow from Nancy. https://github.com/NancyFx/Nancy/wiki/Git-Workflow |
Mono doesn't implement the attributes DataContract/DataMember/IgnoreDataMember, so to be able to use them in Unity/Mono i added a define to implement them in SimpleJson namespace, just define ALTERNATE_DATACONTRACT to enable the alternate definition.