public static string ToRemoteCode(this Asset asset, IDescribesAssets provider) { if (provider == null) { throw new ArgumentException(nameof(provider)); } var cv = provider.GetAssetCodeConverter(); if (cv == null) { return(asset.ShortCode); } return(ToRemoteCode(asset, cv)); }
public static Asset ToAsset(this string assetCode, IDescribesAssets provider) { if (provider == null) { throw new ArgumentException(nameof(provider)); } var cv = provider.GetAssetCodeConverter(); if (cv == null) { return(Assets.I.Get(assetCode, provider)); } return(Assets.I.Get(cv.ToLocalCode(assetCode), provider)); }
public Asset Get(string assetCode, IDescribesAssets provider) { if (string.IsNullOrWhiteSpace(assetCode)) { return(Asset.None); } if (provider == null) { throw new ArgumentException(nameof(provider)); } var cv = provider.GetAssetCodeConverter(); if (cv == null) { return(GetRaw(assetCode)); } assetCode = cv.ToLocalCode(assetCode); return(_cache.GetOrAdd(assetCode, Asset.InstanceRaw)); }