Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "andmattia"

Answer

Hi

I know that MongoDb is not supported but geneally speking is not possibile register a second UnitOfWork?

Question

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();
            }
            
        }
Question

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

  • Any possibile issue?
  • With Linked user can I read data in different tenant?
  • Need to implement disable filter by tenant where I need?

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

  1. download a AngularJs solution
  2. install NPM packege
  3. use webpack like const path = require('path');
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"
                //}
            }
        ]
    }
};
  1. add bundle.js vendor.js in layout.cshtml at the end
  @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

I try to use the abp from NPM and it works on compilation but with some issue.

I compare the 2 different versione and I see the biggest broken change

If I remove the window.app on file from NPM all function works fine but if I don't do it the popup from abp not work, translation not work,...

Answer

Hi

thanks for suggestion.

I also need to ad a webpack script to works.!

Regards

Answer

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;
Question

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

Showing 61 to 70 of 200 entries