Skip to main content

Notifications

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.

  • SergeyP Profile Picture
    2,928 on at
    RE: DatabaseAccessor - obsolete - Sample extensions project

    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?

  • Soren Andersen Profile Picture
    530 on at
    RE: DatabaseAccessor - obsolete - Sample extensions project

    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.

  • nunomaia Profile Picture
    18 Moderator on at
    RE: DatabaseAccessor - obsolete - Sample extensions project

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

    This is a fixed constant 

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
Zain Mehmood Profile Picture

Zain Mehmood 462 Moderator

#2
Danny Bilodeau Profile Picture

Danny Bilodeau 156 Moderator

#3
Laurens vd Tang Profile Picture

Laurens vd Tang 120 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans