Move @using statements to CS file


I have a radzen element that is pulling in a C# model from the domain layer of the app. I'm trying to consolidate my using statements to the partial .cs file.

On the razor page we have the using statement:

@using App.Domain.Models;

This is allowing the Radzen component to see the models for the TItem = RecordModel.

When I move the using statement into the .cs file, the razor page breaks.

Hi @D_Roberts,

I don't think this is possible. The using statements should stay in the .razor file as well as it is compiled as a separate unit (as partial classes).

1 Like