ChunkHelper Class¶
Methods¶
-
Microsoft.AspNet.Mvc.Razor.Directives.ChunkHelper.EnsureChunk<TChunk>(Chunk)
Attempts to cast the passed in @!:Chunk- to type <typeparamref name=”TChunk” /> and throws if the cast fails.
Arguments: - chunk (Chunk) – The chunk to cast.
Return type: TChunk
Returns: The <paramref name=”chunk” /> cast to <typeparamref name=”TChunk” />.
public static TChunk EnsureChunk<TChunk>(Chunk chunk)where TChunk : Chunk
-
GetModelChunk
(ChunkTree)¶ Returns the [Microsoft.AspNet.Mvc.Razor.ModelChunk](Microsoft.AspNet.Mvc.Razor.ModelChunk.yml) used to determine the model name for the page generated using the specified <paramref name=”chunkTree” />
Arguments: - chunkTree (ChunkTree) – The @!:ChunkTree- to scan for [Microsoft.AspNet.Mvc.Razor.ModelChunk](Microsoft.AspNet.Mvc.Razor.ModelChunk.yml)s in.
Return type: Microsoft.AspNet.Mvc.Razor.ModelChunk
Returns: The last [Microsoft.AspNet.Mvc.Razor.ModelChunk](Microsoft.AspNet.Mvc.Razor.ModelChunk.yml) in the @!:ChunkTree- if found, <c>null</c> otherwise.
public static ModelChunk GetModelChunk(ChunkTree chunkTree)
-
GetModelTypeName
(ChunkTree, System.String)¶ Returns the type name of the Model specified via a [Microsoft.AspNet.Mvc.Razor.ModelChunk](Microsoft.AspNet.Mvc.Razor.ModelChunk.yml) in the
<paramref name=”chunkTree” /> if specified or the default model type.
Arguments: - chunkTree (ChunkTree) – The @!:ChunkTree- to scan for [Microsoft.AspNet.Mvc.Razor.ModelChunk](Microsoft.AspNet.Mvc.Razor.ModelChunk.yml)s in.
- defaultModelName (System.String) – The [System.Type]() name of the default model.
Return type: System.String
Returns: The model type name for the generated page.
public static string GetModelTypeName(ChunkTree chunkTree, string defaultModelName)
-
ReplaceTModel
(System.String, System.String)¶ Returns a string with the <TModel> token replaced with the value specified in
<paramref name=”modelName” />.
Arguments: - value (System.String) – The string to replace the token in.
- modelName (System.String) – The model name to replace with.
Return type: System.String
Returns: A string with the token replaced.
public static string ReplaceTModel(string value, string modelName)
-