Class EmbeddedResource
Fetches resources such as script statement text by scriptName from assembly resource stream. Mostly used for SQL and JavaScript but maybe used for any text retrieval. This class is 100% safe for multi-threading operations. Script texts are cached in ram for faster subsequent access.
Inheritance
System.Object
EmbeddedResource
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Azos.Platform
Assembly: Azos.dll
Syntax
public static class EmbeddedResource
Methods
GetBinaryContent(Type, String)
Pass a type and resource path rooted at type's namespace, for example given
using (var stream = typeof(SomeType).GetBinary("My.Picture.gif")){...}
If "SomeType" is declared in "TestApp.Types", then statement's resource will have to be embedded under resource named:
"TestApp.Types.My.Picture.gif"
Declaration
public static byte[] GetBinaryContent(this Type scopingType, string resourceName)
Parameters
Type | Name | Description |
---|---|---|
System.Type | scopingType | |
System.String | resourceName |
Returns
Type | Description |
---|---|
System.Byte[] |
GetBinaryStream(Type, String)
Pass a type and resource path rooted at type's namespace, for example given
using (var stream = typeof(SomeType).GetBinary("My.Picture.gif")){...}
If "SomeType" is declared in "TestApp.Types", then statement's resource will have to be embedded under resource named:
"TestApp.Types.My.Picture.gif"
Declaration
public static Stream GetBinaryStream(this Type scopingType, string resourceName)
Parameters
Type | Name | Description |
---|---|---|
System.Type | scopingType | |
System.String | resourceName |
Returns
Type | Description |
---|---|
System.IO.Stream |
GetText(Type, String)
Pass a type and resource path rooted at type's namespace, for example given
string sql = typeof(SomeType).GetText("SQL.User.Insert.sql");
If "SomeType" is declared in "TestApp.Types", then statement's resource will have to be embedded under resource named:
"TestApp.Types.SQL.User.Insert.sql"
Declaration
public static string GetText(this Type scopingType, string scriptName)
Parameters
Type | Name | Description |
---|---|---|
System.Type | scopingType | |
System.String | scriptName |
Returns
Type | Description |
---|---|
System.String |