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

Remove (int) Cast in Attributes #2

Closed
abilson opened this issue Oct 24, 2017 · 2 comments
Closed

Remove (int) Cast in Attributes #2

abilson opened this issue Oct 24, 2017 · 2 comments

Comments

@abilson
Copy link

abilson commented Oct 24, 2017

This is minor, but it's a pain to cast enums in the attributes. Could we simply change the attribute definition to accept the enum instead of int?

Attribute Definition Before:
public RelativityObjectFieldAttribute(string fieldGuid, int fieldType)

Attribute Definition After:
public RelativityObjectFieldAttribute(string fieldGuid, Gravity.Base.RdoFieldType fieldType)

Attribute Implementation Before:
[RelativityObjectField(guidString, (int)RdoFieldType.FixedLengthText, length)]

Attribute Implementation After:
[RelativityObjectField(guidString, RdoFieldType.FixedLengthText, length)]

@ggachevski
Copy link
Contributor

@abilson, this one has been chasing us for quite some time BIGly and we have not been able to run away from it, at least not in the form it is right now. The reason we do the casts is because under the hood we consider more integer values for conversion. We have two more types of properties. Here is a sample from SqlDao conversion, where we define property for FieldTypeByteArray and FieldTypeCustomListInt:

case (int)RdoFieldType.SingleChoice: case (int)RdoFieldType.SingleObject: case SharedConstants.FieldTypeCustomListInt: case SharedConstants.FieldTypeByteArray:

The solution here is to get rid of the RdoFieldType and define a Gravity-specific enum, yes, or to override it somehow to only contain enums and not have to cast. We just haven't had the time to do this, but I will tag it down on our progress pipeline to be implemented soon.

@ggachevski ggachevski added the status/progress Status: In Progress label Dec 1, 2017
@mrobustelli mrobustelli added this to the 1.0 milestone Apr 19, 2018
@Arithmomaniac Arithmomaniac self-assigned this Apr 19, 2018
@Arithmomaniac
Copy link
Collaborator

Arithmomaniac commented Apr 23, 2018

The FieldType enum is implemented multiple times, e.g. Relativity.Services, RSAPI. We're going to have to create our own local version - which we already have in RDOFieldType.

@Arithmomaniac Arithmomaniac added status/progress Status: In Progress and removed status/progress Status: In Progress labels Apr 24, 2018
mrobustelli added a commit that referenced this issue May 1, 2018
Remove SharedConstant.FieldTypes and int cast #2 #38
@Arithmomaniac Arithmomaniac removed status/progress Status: In Progress status/review Status: In Review labels May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants