pluralize

Why does entity framework pluralize and capitalize entity class names?

丶灬走出姿态 提交于 2019-12-11 14:22:08
问题 Why does entity framework pluralize all the class names and capitalize the first letters by default? What are the advantages of doing this ? Probably a stupid question...but just out of curiosity? 回答1: In the Capitalization Conventions section of the .NET Design Guidelines for Developing Class Libraries, it states that all class names should be in Pascal case, which it defines as: "The first letter in the identifier and the first letter of each subsequent concatenated word are capitalized.

Linq to SQL with table name ending in “es” creates wrong entity class name

不问归期 提交于 2019-12-11 06:29:17
问题 My SQL tables names are all plural - Events, Teams, Campuses, etc... When I drag the tables in to the dbml, it creates an entity called " Campuse " which of course is incorrect. I manually rename that to Campus in the properties page, but it doesnt seem to update all of the auto generated code correctly. For example, the .designer.cs file has the following code: public System.Data.Linq.Table<Campus> Campus when it should be public System.Data.Linq.Table<Campus> Campuses Similar problems with

Ruby on Rails: how to check pluralized and single form of names

浪尽此生 提交于 2019-12-08 18:58:46
问题 I have created a model Anonymous with command rails g model Anonymous section_id:integer aid:string fake:bool active:bool but table name in the migration is called anonymous class CreateAnonymous < ActiveRecord::Migration def change create_table :anonymous do |t| t.integer :section_id t.string :aid t.bool :fake t.bool :active t.timestamps end end end Am i right that pluralized form of Anonymous is Anomymous too ? (English is not my native language). How can i see what pluralized names Rails

FOSRestBundle: How to Avoid Automatic Pluralization of POST /login Route?

天涯浪子 提交于 2019-12-06 04:04:37
I have this Action to handle the user login also via REST api call: /** * Login Action * * @param Request $request */ public function postLoginAction(Request $request) { This is what php app/console router:debug shows me: en__RG__post_login POST ANY ANY /api/1/logins.{_format} In this case the automatic pluralization to " logins " is not so nice... any ideas how to get only " login "? Nisam You can manage default route pluralization by overriding fos_rest.inflector.doctrine service. refer this issue and followed pull request. or for change pluralization of single route it can be done by using

ng-pluralize with translations Error:“TypeError”

半世苍凉 提交于 2019-12-04 18:24:03
Hi I am trying to localize the strings for pluralization in Angular. I am using ng-pluralize directive to handle pluralization and for localizations I am passing the strings to the directive at runtime based on user locale. But I am getting error "TypeError: Object # has no method 'one'" even if the $scope is loaded with translated strings.Following is my html code, <input class="input-text" type="number" ng-model="candyCount" ng-keypress="loadStrings()"/> <ng-pluralize count = "candyCount" when = "translateStrings" ></ng-pluralize> Javascript code myApp.controller(‘MyCtrl’,function($scope){

Android Pluralization not working, need help

戏子无情 提交于 2019-12-03 17:04:55
问题 I've been attempting to utilize the plurals resource with Android but have not had any luck. Here is my resource file for my plurals: <?xml version="1.0" encoding="utf-8"?> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <plurals name="meters"> <item quantity="one">1 meter</item> <item quantity="other"> <xliff:g id="count">%d</xliff:g> meters </item> </plurals> <plurals name="degrees"> <item quantity="one">1 degree</item> <item quantity="other"> <xliff:g id="count">%d</xliff:g

Android Pluralization not working, need help

老子叫甜甜 提交于 2019-12-03 07:16:30
I've been attempting to utilize the plurals resource with Android but have not had any luck. Here is my resource file for my plurals: <?xml version="1.0" encoding="utf-8"?> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <plurals name="meters"> <item quantity="one">1 meter</item> <item quantity="other"> <xliff:g id="count">%d</xliff:g> meters </item> </plurals> <plurals name="degrees"> <item quantity="one">1 degree</item> <item quantity="other"> <xliff:g id="count">%d</xliff:g> degrees </item> </plurals> </resources> ...and then here is the code I am using when I attempt to

Is there a way to use pluralize() inside a model rather than a view?

北城余情 提交于 2019-12-03 03:34:09
问题 It seems pluralize only works within a view -- is there some way that my models can use pluralize too? 回答1: Rather than extend things, I just it like this: ActionController::Base.helpers.pluralize(count, 'mystring') Hope this helps someone else! 回答2: Add this to your model: include ActionView::Helpers::TextHelper 回答3: My favorite way is to create a TextHelper in my app that provides these as class methods for use in my model: app/helpers/text_helper.rb module TextHelper extend ActionView:

Is there a way to use pluralize() inside a model rather than a view?

回眸只為那壹抹淺笑 提交于 2019-12-02 17:27:44
It seems pluralize only works within a view -- is there some way that my models can use pluralize too? Add this to your model: include ActionView::Helpers::TextHelper Rather than extend things, I just it like this: ActionController::Base.helpers.pluralize(count, 'mystring') Hope this helps someone else! My favorite way is to create a TextHelper in my app that provides these as class methods for use in my model: app/helpers/text_helper.rb module TextHelper extend ActionView::Helpers::TextHelper end app/models/any_model.rb def validate_something ... errors.add(:base, "#{TextHelper.pluralize

Plurality in user messages

寵の児 提交于 2019-12-02 14:13:23
Many times, when generating messages to show to the user, the message will contain a number of something that I want to inform the customer about. I'll give an example: The customer has selected a number of items from 1 and up, and has clicked delete. Now I want to give a confirmation message to the customer, and I want to mention the number of items he has selected to minimize the chance of him making a mistake by selecting a bunch of items and clicking delete when he only wants to delete one of them. One way is to make the generic message like this: int noofitemsselected = SomeFunction();