Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Esam-Bustaty
Copy link

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.

@@ -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
Copy link
Member

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.

Copy link
Author

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

Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

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

@Esam-Bustaty
Copy link
Author

Did the rename, it's now SIMPLE_JSON_REDEFINE_DATACONTRACT_ATTRIBUTES.

@@ -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.
Copy link
Member

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

Copy link
Author

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
Copy link
Member

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And Done.

@Esam-Bustaty
Copy link
Author

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?

@prabirshrestha
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants