dmitry-merzlyakov / nledger

.Net Ledger: Double-Entry Accounting System
Other
181 stars 51 forks source link

Amount class gets NullException #23

Closed dirkarnez closed 2 years ago

dirkarnez commented 2 years ago

image

I tried this piece of testing code in .net core 3 and .net framework 4.7, both show the same exception. Thank you!

dmitry-merzlyakov commented 2 years ago

Hi, please check this documentation: https://github.com/dmitry-merzlyakov/nledger/blob/next-dev/build.md

In few words: if you are going to use a Standalone session (so, use NLedger DOM directly in your code), you should organize a scope for it (CreateStandaloneSession):

using(var session = NetSession.CreateStandaloneSession()) { var eur = CommodityPool.Current.FindOrCreate("EUR"); var totalEur = new Amount("0.00 EUR");

Thanks, Dmitry

dirkarnez commented 2 years ago

I see, I missed this documentation. Thank you @dmitry-merzlyakov !