---
title: Loading custom classes from App_Code
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

By preparing custom classes that inherit from an appropriate base class, you can extend the functionality of Kentico. This approach allows you to implement the following types of objects:

- [Integration connectors](https://docs.kentico.com/k10/integrating-3rd-party-systems/using-the-integration-bus/creating-integration-connectors.md)
- [Marketing automation actions](https://docs.kentico.com/k10/on-line-marketing-features/configuring-and-customizing-your-on-line-marketing-features/configuring-marketing-automation/developing-custom-marketing-automation-actions.md)
- [Notification gateways](https://docs.kentico.com/k10/custom-development/miscellaneous-custom-development-tasks/notifications-api/developing-custom-notification-gateways.md)
- [Payment gateways](https://docs.kentico.com/k10/e-commerce-features/customizing-and-developing-your-store/payment-related-customizing/creating-a-custom-payment-gateway.md)
- [Scheduled tasks](https://docs.kentico.com/k10/custom-development/miscellaneous-custom-development-tasks/scheduling-custom-tasks.md)
- Custom [Smart search](https://docs.kentico.com/k10/configuring-kentico/setting-up-search-on-your-website.md) components:
  - [Search indexes](https://docs.kentico.com/k10/custom-development/miscellaneous-custom-development-tasks/smart-search-api-and-customization/creating-custom-smart-search-indexes.md)
  - [Index analyzers](https://docs.kentico.com/k10/custom-development/miscellaneous-custom-development-tasks/smart-search-api-and-customization/creating-custom-smart-search-analyzers.md)
- [Translation services](https://docs.kentico.com/k10/custom-development/miscellaneous-custom-development-tasks/developing-custom-translation-services.md)
- [Workflow actions](https://docs.kentico.com/k10/managing-website-content/configuring-the-environment-for-content-editors/configuring-workflows/designing-advanced-workflows/creating-custom-action-workflow-steps.md)

If you create the custom classes in your project's **App\_Code** folder (or **Old\_App\_Code** on web application installations), you do not need to integrate a new assembly into the web project. Code in the App\_Code folder is compiled dynamically and automatically referenced in all other parts of the system.

## Registering custom classes in the App\_Code folder

To ensure that the system can load custom classes placed in App\_Code, you need to register each class.

1. Edit your custom class.
2. Add a using statement for the **CMS** namespace.
3. Add the **RegisterCustomClass** assembly attribute above the class declaration (for every App\_Code class that you want to register).

```csharp

using CMS;

// Ensures that the system loads an instance of 'CustomClass' when the 'MyClassName' class name is requested.
[assembly: RegisterCustomClass("MyClassName", typeof(CustomClass))]

...

public class CustomClass
{
    ...
}

```

The **RegisterCustomClass** attribute accepts two parameters:

- The first parameter is a _string_ identifier representing the name of the class.
- The second parameter specifies the type of the class as a **System.Type** object. When the system requests a class whose name matches the first parameter, the attribute ensures that an instance of the given class is provided.

Once you have registered your custom classes, you can use them as the source for objects in the system. When assigning App\_Code classes to objects in the administration interface, fill in the following values:

- **Assembly name**: (custom\_classes)
- **Class**: must match the value specified in the first parameter of the corresponding _RegisterCustomClass_ attribute

![Assigning a custom App\_Code class to a new translation service](https://docs.kentico.com/docsassets/k10/loading-custom-classes-from-app_code/Assigning_App_Code_Class.png "Assigning a custom App_Code class to a new translation service")
