C# Class Griffin.MvcContrib.SqlServer.Localization.SqlLocalizedTypesRepository

Used to localize types
Inheritance: ILocalizedTypesRepository, ITypePromptImporter
Afficher le fichier Open project: jgauffin/griffin.mvccontrib Class Usage Examples

Protected Properties

Свойство Type Description
_db ILocalizationDbContext

Méthodes publiques

Méthode Description
CreateLanguage ( CultureInfo culture, CultureInfo templateCulture ) : void

Create translation for a new language

Delete ( CultureInfo culture, TypePromptKey key ) : void

Delete a prompt.

GetAvailableLanguages ( ) : IEnumerable

Get all languages that got partial or full translations.

GetPrompt ( CultureInfo culture, TypePromptKey key ) : TypePrompt

Get a specific prompt

GetPrompts ( CultureInfo cultureInfo, CultureInfo defaultCulture, Griffin.MvcContrib.Localization.SearchFilter filter ) : IEnumerable

Get all prompts

Import ( IEnumerable prompts ) : void

Import prompts into the repository.

Batch for inserting/updating several rows.

This method is not database engine independent (it uses SqlServers MERGE INTO). You must override it to add support for other databases than SqlServer (for instance using REPLACE INTO in MySQL)

Save ( CultureInfo culture, string fullTypeName, string name, string translatedText ) : void

Create or update a prompt

SqlLocalizedTypesRepository ( ILocalizationDbContext db ) : System

Initializes a new instance of the SqlLocalizedTypesRepository class.

Update ( CultureInfo culture, TypePromptKey key, string translatedText ) : void

Update translation

Private Methods

Méthode Description
Create ( CultureInfo culture, string fullTypeName, string name, string translatedText ) : void
Exists ( CultureInfo culture, TypePromptKey key ) : bool
MapEntity ( IDataRecord record ) : TypePrompt
Save ( CultureInfo culture, Type type, string name, string translatedText ) : void

Method Details

CreateLanguage() public méthode

Create translation for a new language
public CreateLanguage ( CultureInfo culture, CultureInfo templateCulture ) : void
culture System.Globalization.CultureInfo Language to create
templateCulture System.Globalization.CultureInfo Language to use as a template
Résultat void

Delete() public méthode

Delete a prompt.
public Delete ( CultureInfo culture, TypePromptKey key ) : void
culture System.Globalization.CultureInfo Culture to delete prompt in
key TypePromptKey Prompt key
Résultat void

GetAvailableLanguages() public méthode

Get all languages that got partial or full translations.
public GetAvailableLanguages ( ) : IEnumerable
Résultat IEnumerable

GetPrompt() public méthode

Get a specific prompt
public GetPrompt ( CultureInfo culture, TypePromptKey key ) : TypePrompt
culture System.Globalization.CultureInfo Culture to get prompt for
key TypePromptKey Key which is unique in the current language
Résultat TypePrompt

GetPrompts() public méthode

Get all prompts
public GetPrompts ( CultureInfo cultureInfo, CultureInfo defaultCulture, Griffin.MvcContrib.Localization.SearchFilter filter ) : IEnumerable
cultureInfo System.Globalization.CultureInfo Culture to get prompts for
defaultCulture System.Globalization.CultureInfo Culture used as template to be able to include all non-translated prompts
filter Griffin.MvcContrib.Localization.SearchFilter The filter.
Résultat IEnumerable

Import() public méthode

Import prompts into the repository.

Batch for inserting/updating several rows.

This method is not database engine independent (it uses SqlServers MERGE INTO). You must override it to add support for other databases than SqlServer (for instance using REPLACE INTO in MySQL)

public Import ( IEnumerable prompts ) : void
prompts IEnumerable Prompts to import
Résultat void

Save() public méthode

Create or update a prompt
public Save ( CultureInfo culture, string fullTypeName, string name, string translatedText ) : void
culture System.Globalization.CultureInfo Culture that the prompt is for
fullTypeName string Type.FullName for the type being localized
name string Property name and any additonal names (such as metadata name, use underscore as delimiter)
translatedText string Translated text string
Résultat void

SqlLocalizedTypesRepository() public méthode

Initializes a new instance of the SqlLocalizedTypesRepository class.
public SqlLocalizedTypesRepository ( ILocalizationDbContext db ) : System
db ILocalizationDbContext Database connection.
Résultat System

Update() public méthode

Update translation
public Update ( CultureInfo culture, TypePromptKey key, string translatedText ) : void
culture System.Globalization.CultureInfo Culture that the prompt is for
key TypePromptKey Unique key, in the specified language only, for the prompt to get)
translatedText string Translated text string
Résultat void

Property Details

_db protected_oe property

database context
protected ILocalizationDbContext _db
Résultat ILocalizationDbContext