Skip to content

Support for read-only properties #640

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

Merged
merged 7 commits into from
Aug 30, 2018

Conversation

Ivanidzo4ka
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka commented Aug 3, 2018

Suggestion how to fix #631
This would let user pass partially visible properties, but in same time, use will have to mark some of them if he don't want them to be exposed.

Verified

This commit was signed with the committer’s verified signature.
jvdp1 Jeremie Vandenplas
@Ivanidzo4ka Ivanidzo4ka requested a review from Zruty0 August 3, 2018 00:58
@Ivanidzo4ka Ivanidzo4ka requested a review from dsyme August 7, 2018 23:34
@Ivanidzo4ka Ivanidzo4ka changed the title WIP Sketch to support read-only properties Sketch to support read-only properties Aug 7, 2018
/// <returns>The generated schema definition.</returns>
public static SchemaDefinition Create(Type userType)
public static SchemaDefinition Create(Type userType, Direction direction)
Copy link
Contributor

@Zruty0 Zruty0 Aug 9, 2018

Choose a reason for hiding this comment

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

direction [](start = 71, length = 9)

I guess it should be Both by default... #Resolved

// This property is ignored because it has a private getter

[NoColumn]
// This property can be used as recipticle for dataview, but not as source for dataview.
Copy link
Contributor

@Zruty0 Zruty0 Aug 9, 2018

Choose a reason for hiding this comment

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

recipticle [](start = 44, length = 10)

receptacle #Resolved

@@ -978,5 +981,48 @@ public void RoundTripConversionWithArrayPropertiess()
Assert.True(!enumeratorNullable.MoveNext() && !originalNullalbleEnumerator.MoveNext());
}
}


class ClassWithPrivateGetter
Copy link
Contributor

@Zruty0 Zruty0 Aug 9, 2018

Choose a reason for hiding this comment

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

PrivateGetter [](start = 23, length = 13)

not 'private', just 'getter' #Resolved

@@ -36,7 +36,7 @@ internal sealed class MapTransform<TSrc, TDst> : LambdaTransformBase, ITransform
private static string RegistrationName { get { return string.Format(RegistrationNameTemplate, typeof(TSrc).FullName, typeof(TDst).FullName); } }

/// <summary>
/// Create a a map transform that is savable iff <paramref name="saveAction"/> and <paramref name="loadFunc"/> are
/// Create a a map transform that is savable if <paramref name="saveAction"/> and <paramref name="loadFunc"/> are
Copy link
Contributor

@Zruty0 Zruty0 Aug 9, 2018

Choose a reason for hiding this comment

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

if [](start = 53, length = 2)

'iff' is a actual wordd. It meanss 'if and only if'. #Resolved

Copy link
Contributor

@Zruty0 Zruty0 left a comment

Choose a reason for hiding this comment

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

:shipit:

@Ivanidzo4ka
Copy link
Contributor Author

Ivanidzo4ka commented Aug 17, 2018

@TomFinley @yaeldekel @ganik @dsyme any one is willing to review?

{
Read = 0,
Write = 1,
Both = Read | Write
Copy link
Contributor

@TomFinley TomFinley Aug 22, 2018

Choose a reason for hiding this comment

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

Both = Read | Write [](start = 12, length = 19)

Note that since Read is 0, and Write is 1, and 10|1==1 you cannot distinguish between Both and Write as they are identical, this is not right -- at least, so I think given how you're using this enum. I think you meant to do something like have read and write be 1 and 2 respectively. Also I think if you're doing this you're going to want to set the Flags attribute on the enum.

You could perhpas have just two things, since the utility of write-only properties is far from clear to me. #Resolved

Copy link
Contributor

@TomFinley TomFinley Aug 24, 2018

Choose a reason for hiding this comment

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

Hi @Ivanidzo4ka thanks for looking at this -- one thing that I mentioned that might have gotten lost in my comment, was using the Flags attribute, which is sort of a nice thing to put on enums intended to be used as bitflags.


In reply to: 212057212 [](ancestors = 212057212)

Copy link
Contributor

@TomFinley TomFinley left a comment

Choose a reason for hiding this comment

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

Hi @Ivanidzo4ka , pretty close the only real problem I'm seeing is the whole enum. Also maybe you want to more clearly title your PR since the way it's titled now "sketch" strongly suggests it is not something that is finalized.

@Ivanidzo4ka Ivanidzo4ka changed the title Sketch to support read-only properties Support for read-only properties Aug 23, 2018
@Ivanidzo4ka
Copy link
Contributor Author

@TomFinley I think I address all your comments, can we check this in?

@shauheen
Copy link
Contributor

@TomFinley can you please take a look at this PR :)

@shauheen shauheen added the enhancement New feature or request label Aug 28, 2018
@shauheen shauheen added this to the 0818 milestone Aug 28, 2018
Copy link
Contributor

@TomFinley TomFinley left a comment

Choose a reason for hiding this comment

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

:shipit:

@shauheen shauheen merged commit 6f4c8c5 into dotnet:master Aug 30, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support read-only properties somehow
4 participants