We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Custom DataAdaptor with parameters

Dear Syncfusion Team,

I try to create a Custom DataManager Adaptor where I have access to the IHttpContextAccessor or can use constructor injection.

But it seems like the DataAdaptor is only allowing a parameterless constructor.

Is there a way to either create the DataAdaptor instance through injection, so that it's possible to inject as many parameters as needed or initialize the AdaptorInstance in the own code and bind the 
AdaptorInstance instead of the type. (e.g. AdaptorInstance="@new TestAdapter(...)")

Or maybe there is an other way to solve my problem?

Regards, 
Gereon Arz







...
<EjsDataManager AdaptorInstance="@typeof(TestAdapter)" Adaptor="Adaptors.CustomAdaptor"></EjsDataManager>
...

@code {

      public class TestAdapter : DataAdaptor
     {    
            public TestAdapter(IHttpContextAccessor HttpContextAccessor) {  }
     }
}

4 Replies

VN Vignesh Natarajan Syncfusion Team October 15, 2019 10:06 AM UTC

Hi Gereon,  
 
Thanks for contacting Syncfusion support.  
 
Query1: “so that it's possible to inject as many parameters as needed or initialize the AdaptorInstance in the own code. 
 
Currently we do not have  support to achieve your requirement. But since it is a known requirement, we have considered it as an improvement “Provide support to inherit DataAdaptor from OwningComponentBase”. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We have planned this feature for our 2019 Volume 3 Service pack 1 release (Bi-Weekly Nuget release) which is expected to be rolled out on or before 31st October 2019. We will let you know when this feature is implemented. 
 
You can track the current status of this feature request and also communicate with us regarding the open features any time using our Feature Report page. 
 
 
Till then we appreciate your patience. 
 
Regards,
Vignesh Natarajan.
 
 



GA Gereon Arz October 16, 2019 08:30 PM UTC

Thanks for the reply. 

I'm looking forward to Volume 3 Service pack 1.

Regards, 
Gereon Arz


VN Vignesh Natarajan Syncfusion Team October 17, 2019 04:56 AM UTC

Hi Gereon,  

Thanks for the update.  

We will get back to you once our Bi-Weekly Nuget release gets successfully rolls out.  

Regards,
Vignesh Natarajan. 



VN Vignesh Natarajan Syncfusion Team November 13, 2019 10:00 AM UTC

Hi Gereon,  
 
We are glad to inform that our latest Nuget package (17.3.0.27-beta) has been successfully rolled out. In this release, we have migrated our Components to .Net Core 3.1 Preview 2 and also provided “Support to inherit dataadaptor from owingcomponentbase and to use dependency injection”. Please find the latest Nuget package from below and also find the release notes regarding the fixes we have included in this release.  
 
 
 
Also ensure that you have referred the latest version script and css as below  
 
  <link rel='nofollow' href="https://cdn.syncfusion.com/ej2/17.3.27/fabric.css" rel="stylesheet" /> 
 
 
Kindly refer our UG documentation for your reference  
 
 
Please get back to us if you have further queries. 
 
Regards, 
Vignesh Natarajan.

Loader.
Live Chat Icon For mobile
Up arrow icon