This is a migrated thread and some comments may be shown as answers.

Field Naming rules for whole context

2 Answers 64 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jonah
Top achievements
Rank 1
Jonah asked on 25 Aug 2015, 07:42 PM

I am applying naming rules to each of my tables like categoryConfig.FieldNamingRules.AddPrefix = "_"; so I don't have add the field name to each definition.

Is there a way to apply the same rule to the whole context?

2 Answers, 1 is accepted

Sort by
0
Pavel Uzunov
Telerik team
answered on 28 Aug 2015, 11:15 AM
Hi Jonah,

You can easily set FieldNamingRules to all your configurations with a simple loop:
protected override IList<MappingConfiguration> PrepareMapping()
{
    List<MappingConfiguration> configurations = new List<MappingConfiguration>();
 
    ...
  
    configurations.ForEach(c => c.FieldNamingRules.AddPrefix = "_");
  
    return configurations;
}

I hope this helps. Should you have any further questions do not hesitate to get back to us. 

Regards,
Pavel Uzunov
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
Vitaliy
Top achievements
Rank 1
answered on 10 Mar 2016, 09:39 AM

What if I use a 

http://docs.telerik.com/data-access/developers-guide/code-only-mapping/mapping-clr-types-properties-and-associations/fluent-mapping-integration-enhancer-per-class-configuration

?

Tags
Development (API, general questions)
Asked by
Jonah
Top achievements
Rank 1
Answers by
Pavel Uzunov
Telerik team
Vitaliy
Top achievements
Rank 1
Share this question
or