web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Unanswered

DatabaseAccessor - obsolete - Sample extensions project

(0) ShareShare
ReportReport
Posted on by 530

We have to implement the Nowegian requirements for POS registers - and I am looking into the sample projects:

Runtime.Extensions.SalesPaymentTransExt 

We have to start with the legacy connector - since we are not on the new commerce sdk. (know they are deprecated and update is needed. )

In one the files we have:

ParameterSet parameters = new ParameterSet();
parameters[DatabaseAccessor.ChannelIdVariableName] = request.RequestContext.GetPrincipal().ChannelId;
parameters[sourceTableNamePrm] = sourceTable;

int errorCode;

using (var databaseContext = new DatabaseContext(request.RequestContext))
{
errorCode = await databaseContext.ExecuteStoredProcedureNonQueryAsync(insertProcName, parameters, resultSettings: null).ConfigureAwait(false);
}

if (errorCode != (int)DatabaseErrorCodes.Success)
{
throw new StorageException(StorageErrors.Microsoft_Dynamics_Commerce_Runtime_CriticalStorageError, errorCode);
}

Where DatabaseAccessor is marked as obsolete. So I guess it will not work any more. 

any hints of how to work-around this.

  • nunomaia Profile Picture
    27 Moderator on at

    The only compilation error that you are getting is on DatabaseAccessor.ChannelIdVariableName ?

    This is a fixed constant 

  • Soren Andersen Profile Picture
    530 on at

    Actually it is only a compiler warning - and the compiler marks the line green.

    I will try to test if it works. We just have some coding using the RetailLogger - which is obsolete as well, at that caused some problems, so I would avoid in advance is there was and "easy" solution.  I looked into the sample of the commerce SDK  - but could not find an "updated" example for this sample extension project.

  • SergeyP Profile Picture
    2,928 on at

    You can safely define the constant as:

    private const string ChannelIdVariableName = "@bi_ChannelId";

    It is good idea to set your project settings to Treat Warnings as Errors instead of trying to track "OK" warnings vs really "No OK" ones as there is a risk then to easily miss things which will create issues at runtime.

    >... We just have some coding using the RetailLogger - which is obsolete as well, ...

    Can you share exact code segment you are using where you see an Obsolete warning?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 99 Super User 2026 Season 2

#2
Paolo Cecchelli Profile Picture

Paolo Cecchelli 71 Super User 2026 Season 2

#2
Aayush Tiwari Profile Picture

Aayush Tiwari 71

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans