This is a migrated thread and some comments may be shown as answers.

Basecontroller

1 Answer 321 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Deenadhayalan
Top achievements
Rank 1
Deenadhayalan asked on 23 Oct 2018, 12:11 PM

I wanted to use Telerik Asp.Net Core plugins in my project. When I am trying to copy the menu component of Telerik UI, it throws error on Basecontroller class and [Demo] annotations. Please let me know, what is this error about and how to fix it.

1 Answer, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 26 Oct 2018, 06:18 AM
Hi Deenadhayalan,

The BaseController class inherits from Microsoft.AspNetCore.Mvc.Controller and implements a common constructor and a GetContext() method, which would be reused in all other controllers which inherit from that one:
public abstract class BaseController : Controller
{
    public BaseController()
    {
        CultureInfo.DefaultThreadCurrentCulture =
            CultureInfo.DefaultThreadCurrentUICulture =
            new CultureInfo("en-US");
    }
    public virtual SampleEntitiesDataContext GetContext()
    {
        return new SampleEntitiesDataContext();
    }
}

The DemoAttribute is an attribute, that we need for our Demo application. You could safely remove that attribute from your implementation.

The full implementation of the above classes could be found in the Examples project, which we ship with our suite. If you have downloaded the archive available in your Telerik account, that is located in the wrappers\aspnetcore\Examples\AspNet.Core\VS2017 folder. If you have installed the suite on your Windows machine, by default, the Examples application should be present in the C:\Program Files (x86)\Progress\Telerik UI for ASP.NET Core R3 2018\wrappers\aspnetcore\Examples\AspNet.Core\VS2017 folder.

The BaseController class implementation is available in the Controllers folder of the above project, while the DemoAttribute is placed in the ActionFilters folder.

I hope that the above explains the case. If you have any other questions, please do not hesitate to contact us.

Regards,
Veselin Tsvetanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Menu
Asked by
Deenadhayalan
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or