# SurrealDbNamespaceResource

- Module: [CommunityToolkit.Aspire.Hosting.SurrealDb](/reference/api/typescript/communitytoolkit.aspire.hosting.surrealdb.md)
- Version: `13.4.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire)

A resource that represents a SurrealDB namespace that is a child of a SurrealDB container resource.

## Definition

```typescript
interface SurrealDbNamespaceResource
  extends IExpressionValue,
    IManifestExpressionProvider,
    IResource,
    IResourceWithConnectionString,
    IResourceWithParent,
    SurrealDbServerResource]],
    IValueProvider,
    IValueWithReferences {
  readonly connectionStringExpression: ReferenceExpression;
  readonly databases: Dict<string,string>;
  readonly namespaceName: string;
  readonly parent: SurrealDbServerResource;
  addDatabase(
      name: string,
      databaseName?: string): SurrealDbDatabaseResource;
  withCreationScript(script: string): SurrealDbNamespaceResource;
}
```

## Properties

- `connectionStringExpression`: `ReferenceExpression` `get` -- Gets the connection string expression for the SurrealDB database.
- `databases`: `Dict<string,string>` `get` -- A dictionary where the key is the resource name and the value is the database name.
- `namespaceName`: `string` `get` -- Gets the namespace name.
- `parent`: [SurrealDbServerResource](/reference/api/typescript/communitytoolkit.aspire.hosting.surrealdb/surrealdbserverresource.md) `get` -- Gets the parent SurrealDB container resource.

## Methods

- [addDatabase](/reference/api/typescript/communitytoolkit.aspire.hosting.surrealdb/surrealdbnamespaceresource/adddatabase.md) -- `method` -- Adds a SurrealDB database resource to the application model
    ```typescript
  addDatabase(name: string, databaseName?: string): SurrealDbDatabaseResource
  ```
- [withCreationScript](/reference/api/typescript/communitytoolkit.aspire.hosting.surrealdb/surrealdbnamespaceresource/withcreationscript.md) -- `method` -- Defines the SQL script used to create the namespace.
    ```typescript
  withCreationScript(script: string): SurrealDbNamespaceResource
  ```
