scriptsharp icon indicating copy to clipboard operation
scriptsharp copied to clipboard

Wrong notation while converting properties in c# to Javascript function

Open chandramuralis opened this issue 12 years ago • 6 comments

I have a property like public string PROD_SIMP_LIST in my C# class. The javascript is generated as below get_proD_SIMP_LIST() and set_proD_SIMP_LIST().

C# Code


public string PROD_SIMP_LIST { get {} set {} }

Javascript


get_proD_SIMP_LIST: function entity$get_proD_SIMP_LIST() {}

set_proD_SIMP_LIST: function entity$set_proD_SIMP_LIST() {}

chandramuralis avatar Jun 22 '12 18:06 chandramuralis

What should all caps properties be generated as when camel-casing happens? Remain all caps?

nikhilk avatar Jun 22 '12 19:06 nikhilk

I think it should leave it as all upper case, because if I define my property in all lower case the generated output is all lower case. To be frank I don't have any personal preference, but it shouldn't be like how it is now.

chandramuralis avatar Jun 22 '12 20:06 chandramuralis

Could I add on to this and request that the [PreserveCase] attribute be allowed at the class level? Or even better at the assembly level?

michaelaird avatar Jul 13 '12 11:07 michaelaird

+1 on the PreserveCase attribute working at the assembly level. It would go a long way towards preventing mismatched names, which chews up a lot of time.

Cheers, Daniel

DVaughan avatar Aug 17 '12 09:08 DVaughan

+1 on both PreseveCase per class and per assembly, both cases are usefull. But if I was asked to choose, I would prefere the class level.

Eddy-Shterenberg avatar Aug 18 '12 21:08 Eddy-Shterenberg

+1 on [PreserveCase] on class level because reading JSON Serialized POCO Objects by JavaScriptSerializer is currently a pain to map into existing JS Objects sharing the same Properties.

andekande avatar Sep 28 '12 11:09 andekande