Skip to content

Commit

Permalink
Update version
Browse files Browse the repository at this point in the history
  • Loading branch information
Kation committed Nov 17, 2021
1 parent 6375fd7 commit eb26be2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Wodsoft Protobuf Wrapper
# Wodsoft Protobuf Wrapper

## Contents

Expand Down Expand Up @@ -64,7 +64,13 @@ You can pass a `Google.Protobuf.CodedInputStream` from your context.
YourModel model = new ();
CodedInputStream input = ...;
Message.Serialize(input, model);
```

Or you want to serialize to bytes directly.

```csharp
YourModel model = new ();
var bytes = Message.SerializeToBytes(model);
```

### Deserialize
Expand All @@ -86,6 +92,12 @@ CodedOutputStream output = ...;
YourType model = Message.Deserialize<YourType>(output);
```

Or you want to deserialize from bytes directly.

```csharp
YourType model = Message.DeserializeFromBytes<YourType>(bytes);
```

### Field Definition

`IMessageFieldProvider.GetFields(Type type)` will return message fields that map from a object type.
Expand All @@ -98,9 +110,12 @@ And set `Message<T>.FieldProvider` to your field provider instance value.

### Field Order

Use `System.Runtime.Serialization.DataMemberAttribute` for your properties and set the `Order` property to attribute.
Use `System.Runtime.Serialization.DataMemberAttribute` for your properties and set the `Order` property to attribute.
Otherwise it will order properties with name.

> **⚠️** If there is a `DataMemberAttribute` on any property, it will **ONLY** serialize or deserialize with properties which has `DataMemberAttribute`.
**Important:** If there is a `DataMemberAttribute` on any property, it will only serialize or deserialize with properties which has `DataMemberAttribute`.
> **⚠️** If there is no `DataMemberAttribute` exists, communication with difference version model program maybe **FAULT** because of difference property **ORDER**.
### Non empty parameter constructor object

Expand Down
4 changes: 2 additions & 2 deletions src/Wodsoft.Protobuf.Wrapper/Wodsoft.Protobuf.Wrapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageProjectUrl>https://github.com/Kation/Wodsoft.Protobuf.Wrapper</PackageProjectUrl>
<RepositoryUrl>https://github.com/Kation/Wodsoft.Protobuf.Wrapper</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>1.0.0-preview7</Version>
<Version>1.0.0</Version>
<IncludeSymbols>true</IncludeSymbols>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
Expand All @@ -23,7 +23,7 @@
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.18.0" />
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'netstandard2.0'">
Expand Down

0 comments on commit eb26be2

Please sign in to comment.