Hi
I know that MongoDb is not supported but geneally speking is not possibile register a second UnitOfWork?
I'm working on a solution wiht more EF and I'm able to call separete EF and use distributed query.
Last week I need to add a a connection to MongoDb to storage a Json data so I've created a custom repository connect my Entity to MongoDb and it work fine until I call that from an abstract base class.
The CreateQuery flow on correct repository because use concrete implementation (es Mongo or EF dipends on specific query body)
But when I call the CountAsync() how can I identify if my provider is Mongo or EF...
At the moment i create a SafeCountAsync() and cast to specific provider but I'm not sure that is the correct way to solve it.
Below some code from my solution
public abstract IQueryable<TQueryReturnType> CreateQuery(TQueryInput input);
public asbtract class MyBase{
/// remove for brevity
public virtual async Task<PagedResultDto<TListResult>> GetItems(TQueryInput input)
{
var query = CreateQuery(input).
.ApplyFilter(input);
#if DEBUG
Debug.WriteLine($"Query for {typeof(TQueryReturnType)}");
Debug.Write(query?.ToString());
#endif
//var count = await query.CountAsync();
var count = await query.SafeCountAsync();
}
}
// from static extension to call correct count
public static Task<int> SafeCountAsync<TSource>(this IQueryable<TSource> source)
{
IsValid(source);
if (typeof(IMongoTable).IsAssignableFrom(typeof(TSource)))
{
return ((IMongoQueryable<TSource>)source).CountAsync();
}
else
{
// Default EF SQL
return source.CountAsync();
}
}
Hi
I have a question about this use case.
In an appalication multiTenant I create a user on Tenant 1.
This user start to work with the paltform and decide to subscribe a payment tenant for him, so I preapre some custom function to create, update data on new tenant and now my user (create on Tenat1 and link to it) is the admin of tenant 2. But tenant 1?
I try to think a possibile solution case.
Linked user. But is it the only/correct way to implement it.. Also
Regards
Mat
@maliming
it works, so now I need to publish on my private NPM this version beacuse every time to compile NPM overvrite the abp.js on base node_module dirs.
Any suggestion?
Hi
module.exports = {
entry: "./src/index.ts",
//output: {
// filename: "../libs/custom/bundle.js"
//},
output: {
path: path.resolve(__dirname, 'libs/custom'),
filename: '[name].js'
},
resolve: {
// Add '.ts' and '.tsx' as a resolvable extension.
extensions: [".webpack.js", ".web.js", ".ts", ".tsx", ".js"]
},
optimization: {
splitChunks: {
chunks: 'all',
},
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: [/node_modules/],
loader: "ts-loader",
//options: {
// configFile: "webpack_configs/tsconfig.webpack.json"
//}
}
]
}
};
@Scripts.Render("~/Bundles/App/metronic/js")
@Scripts.Render("~/Bundles/Common/js")
@Scripts.Render("~/Bundles/App/js")
<script src="~/libs/custom/bundle.js"></script>
bundle need to be compile for prduction
"scripts": {
"test": "echo",
"compileTsc": "tsc",
"dev": "rimraf dist && webpack --bail --progress --profile --mode development --display-error-details",
"prod": "rimraf dist && webpack --mode production --progress"
},
Hi
Yes I think is releted to this PR
Hi
thanks for suggestion.
I also need to ad a webpack script to works.!
Regards
Hi
thanks for the link but I see that is abp.d.ts file not a @types.
If I don't put on node_module/@type/abp/index.d.ts when I use on TS file i give the error
error TS2688: Cannot find type definition file for 'abp'.
on my ts file
import * as angular from 'angular';
import * as abp from 'abp';
also I need to modify abp.d.ts file on top with this row
export as namespace abp;
declare const abp: abp;
export = abp;
declare namespace abp {
let appPath: string;
Hi
I migrate from AngualrJs to Core and now we start to convert code to TypeScript (3.8.3). I need to copy on node_module@types a folder abp with abp.d.ts ranamend as index.d.ts.
I check if exsist a NPM type name but I don't find it, is it correct?
Any suggestion to use D.TS for Abp