Skip to main content

Notifications

Announcements

No record found.

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
    SergeyP 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
    Soren Andersen 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
    nunomaia 11 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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans