"alexander.nikonov" 'in aktiviteleri

I have not tried to deploy to local IIS server yet - in fact, it's even not set up, because we supposed to use remote DEV machine for running our backend. BTW, when I run this app via IIS Express - I can't see the 'Lepton.Global' bundle loading at all. I've tried to figure out what this bundle was about, playing around AbpBundlingOptions in my IdentityServerModule and hoping to override LeptonThemeBundles.Scripts.Global / LeptonThemeBundles.Styles.Global bundles - but seems like those are not bundle names...

I hope it will be easy... :) Step 1) Create a boilerplate project, as described in the abp doc; Step 2) Create the folder on a remote machine for publishing IdentityServer project, set it up as an IIS application under Default Web Site and assign a separate app pool to it: Step 3) Publish IdentityServer project to that remote machine using the publish profile as below (please replace XXX / YYY / ZZZ and some other dummy values with relevant values):

IdentityServer_to_RemoteMachine.pubxml

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>MSDeploy</WebPublishMethod>
    <PublishProvider>AzureVirtualMachine</PublishProvider>
    <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish>http://XXX.cloudapp.azure.com/YYY.IdentityServer</SiteUrlToLaunchAfterPublish>
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <ProjectGuid>073c361e-b8f4-49f5-93cc-72a3ff49c026</ProjectGuid>
    <MSDeployServiceURL>XXX.cloudapp.azure.com:8172</MSDeployServiceURL>
    <DeployIisAppPath>Default Web Site\YYY.IdentityServer</DeployIisAppPath>
    <RemoteSitePhysicalPath />
    <SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
    <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
    <EnableMSDeployBackup>True</EnableMSDeployBackup>
    <UserName>YOUR_USERNAME</UserName>
    <_SavePWD>True</_SavePWD>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <SelfContained>false</SelfContained>
  </PropertyGroup>
</Project>

IdentityServer_to_RemoteMachine.pubxml.user

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <TimeStampOfAssociatedLegacyPublishXmlFile />
    <EncryptedPassword>YOUR_ENCRYPTEDPASSWORD</EncryptedPassword>
  </PropertyGroup>
  <ItemGroup>
    <DestinationConnectionStrings Include="Default">
      <Value>YOUR_CONNECTIONSTRING</Value>
    </DestinationConnectionStrings>
  </ItemGroup>
</Project>

Step 3) When the published IdentityServer website is being run, you (hopefully) will see the same broken UI as reported by me earlier;

I've tried that (I used EntityFrameworkCore project as a base and added the Microsoft.EntityFrameworkCore.Design reference as asked by the tool). After running migration tool, I'm getting

Unable to create an object of type 'XXXXDbContext' //this is the class inherited from AbpDbContext<XXXXDbContext>

I see now... But is dotnet-ef tool the same thing as Microsoft.EntityFrameworkCore.Tools package? So basically I can use PM commands add-migration / script-migration -from 0 and so on instead? I just need to leave only ABP-related tables inside CentralToolsMigrationsDbContext.OnModelCreating method.

OK, thanks, now I know the property values not changed, but parameter values instead. But what do you mean by DTO normalization? Carry on some operations on DTOs? But if so - it's easier just to re-read the entity to get correct up-to-date values.

Saying honestly, not a very good solution, imho. Usually DTO is just a bunch of fields and should not contain some functionality. Handling all the logic in OnModelCreating looks fine and logical. So - since it's not possible to get new data straight from update object - I think I will have to re-read the entity.

Thank you for the suggestion. I have tried it, but I bumped into the same issue as already described - using ABP TenantService directly, without implementing a custom one: first INSERT operation was pretty long, but succeeded. However, when I tried to insert another Tenant - it stuck with the same row lock notification (see the screenshot above). BTW, nested transaction (using two nested IOW) also does not resolve the problem. I understand that transaction commit when calling CompleteAsync MUST release all the locks, but for some reason it does not work as expected. P.S. This bug is present in ABP Framework 3.0.5 as well. P.S.2. BTW - I think Repository needs to be used, not AppService. When I use TenantAppService - the first insert does not rollback if second one fails.

Meanwhile I came up with the following simple solution:

            using var uow = _unitOfWorkManager.Begin(requiresNew: true);
            var abpTenant = await _abpTenantManager.CreateAsync(input.AbpTenant.Name, input.AbpTenant.EditionId);
            input.AbpTenant.MapExtraPropertiesTo(abpTenant);
            var tenant = ObjectMapper.Map&lt;CreateTenantDto, Tenant&gt;(input);
            tenant.AbpTenant = abpTenant;
            var newTenant = await _tenantRepository.InsertAsync(tenant);
            await uow.CompleteAsync();

            return ObjectMapper.Map&lt;Tenant, TenantDto&gt;(newTenant);
            

Seems like it works - it is enough to use sole InsertAsync for our Tenant entity, reference AbpTenant entry is inserted automatically, since it's being tracked by uow IUnitOfWork instance, right?

I have also checked the scenario when something is wrong with inserting our Tenant entity - AbpTenant is not inserted either. But the question is - when do I need to use isTransactional: true here? Is it when I have several repository CRUD operations?? Please explain.

Another question is regarding your repositories. I have noticed you never 'play' with CurrentValues.SetValues in DbConext, but always use Update call, so ALL fields are always updated even if not changed. Any reason for that?

UPDATE: Summarizing, I can tell that everything looks fine as long as I use don't use isTransactional: true. For instance, this works in positive scenario:

        using var tenantUow = _unitOfWorkManager.Begin(requiresNew: true);
        var abpTenant = tenant.AbpTenant;
        await _tenantRepository.DeleteAsync(tenant);
        await _abpTenantRepository.HardDeleteAsync(abpTenant);
        await tenantUow.CompleteAsync();
        

BUT if something is WRONG with second delete - first delete comes through (not rolled back). If I use isTransactional: true and intentionally fail second delete for test - the operation just hangs (DB lock):

        using var tenantUow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
        var abpTenant = tenant.AbpTenant;
        await _tenantRepository.DeleteAsync(tenant);
        await _abpTenantRepository.HardDeleteAsync(abpTenant);
        await tenantUow.CompleteAsync();

To workaround this, I had to create custom delete method in Tenant repository and made use of TransactionScope

Ok, thank you - I understand all this. But how to resolve the issue with row lock when using isTransactional: true on CompleteAsync? It does not look like a proper behavior, does it? CompleteAsync needs to commit all the changes within UOW area, but instead, we receive a row lock as shown on screenshots from SQL Manager above. I was able to workaround the issue in one case simply because I have moved all the logic into one repository. Though, I have a different case, where the logic is spread across multiple repositories using within the same UOW instance. And this is where row lock happens. Please provide me with Oracle test instance where I can connect and I will demostrate it.

Could you please try this example on Oracle DB (any version starting from 12c), since this is what we are using? It would be great to isolate DB and make sure it is not an Oracle issue.

230 kayıttan 1 ile 10 arası gösteriliyor.
Made with ❤️ on ABP v8.2.0-preview Updated on Mart 25, 2024, 15:11