Base solution for your next web application

Activities of "lcyhjx"

Hi, What I expected is: 1 call /api/account/Authenticate to get a token 2 Use the token to call an authorized api service 3 logout 4 use the original token to call an authorized api service, expect to get an ‘not login’ error Currently, step 1 and step 2 are works fine. And for logout, I add new action in AccountController in Web Api layer

private IAuthenticationManager AuthenticationManager => Request.GetOwinContext().Authentication;   
        [HttpPost]
        [ActionName("Logout")]
        public AjaxResponse Logout()
        {
            AuthenticationManager.SignOut();
            return new AjaxResponse();
        }

But when I tested, after call the logout service. Then executed step 4, still success, did not get the ‘not login’ error. Does anyone know that’s the issue is and how to fix?

The permission entity in code has following property: Name, Display name, Description, MultiTenancySides and featureDependency. But in the AbpPermissions data tabble, it just has a name field. Where are the Display name and Description (localization key) stored in?

Sharing: Using MySql in ABP sample project

1 Download sample project from ABP website 2 Install MySql on windows, create a database named ‘sampledb’ <a class="postlink" href="https://dev.mysql.com/doc/refman/8.0/en/mysql-installer-gui.html">https://dev.mysql.com/doc/refman/8.0/en ... r-gui.html</a> <a class="postlink" href="https://downloads.mysql.com/archives/installer/">https://downloads.mysql.com/archives/installer/</a> 3 Install MySql.Data.Entity in EntityFramwwork and Web Projects Install-Package MySql.Data.Entity -Version 6.8.3 / Install-Package MySql.Data.Entity Please ensure don't install the laest version of MySql.Data.Entity, since the ABP sample project using .net framework 4.5.2, it will cause some exceptions

4 Change web.config in Web Project <entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6"> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> <providers> <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> </providers> </entityFramework>

<connectionStrings> <add name="Default" providerName="MySql.Data.MySqlClient" connectionString="server=localhost;port=3306;database=sampledb;uid=root;password=*** " /> </connectionStrings>

<a class="postlink" href="http://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html">http://dev.mysql.com/doc/connector-net/ ... ork60.html</a>

5 Run Update-Database –Verbos 6 Then you can run the sample ABP project successfully.

Today, I tried to using MySql in Abp sample project, but failed. I am guess the issue is caused by Abp.Zero.EntityFramework, can anyone know how to address it?

1 download sample project from ABP website 2 install MySql on windows, create a database named ‘sampledb’ <a class="postlink" href="https://dev.mysql.com/doc/refman/8.0/en/mysql-installer-gui.html">https://dev.mysql.com/doc/refman/8.0/en ... r-gui.html</a> <a class="postlink" href="https://downloads.mysql.com/archives/installer/">https://downloads.mysql.com/archives/installer/</a> 3 Install MySql.Data.Entity in EntityFramwwork and Web Project Install-Package MySql.Data.Entity -Version 6.9.9, it will install the dependency Mysql.Data also 4 Change web.config in Web Project <entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6"> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> <providers> <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers> </entityFramework> <connectionStrings> <add name="Default" providerName="MySql.Data.MySqlClient" connectionString="server=localhost;port=3306;database=sampledb;uid=root;password=*** " /> </connectionStrings>

<a class="postlink" href="http://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html">http://dev.mysql.com/doc/connector-net/ ... ork60.html</a> 5 Run Update-Database –Verbos in Package Manager Console, errors in the console. you can check the error message below. I am sure the MySql.Data is installed in EntityFramework and Web project. And also I can see it in packages folder.

system.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at MySql.Data.Entity.MySqlEFConfiguration..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Data.Entity.Utilities.TypeExtensions.CreateInstance[T](Type type, Func2 exceptionFactory) at System.Data.Entity.Utilities.TypeExtensions.CreateInstance[T](Type type, Func3 typeMessageFactory, Func2 exceptionFactory) at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.<.ctor>b__1() at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue() at System.Lazy1.get_Value() at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.GetConfiguration() at System.Data.Entity.DbContext.InitializeLazyInternalContext(IInternalConnection internalConnection, DbCompiledModel model) at System.Data.Entity.DbContext..ctor(String nameOrConnectionString) at Abp.Zero.EntityFramework.AbpZeroDbContext`3..ctor(String nameOrConnectionString) in D:\Halil\Github\module-zero\src\Abp.Zero.EntityFramework\Zero\EntityFramework\AbpZeroDbContext.cs:line 72 at HL.TSE.EntityFramework.TSEDbContext..ctor() in C:\E\MyPrograme\DoNet\HL.TSE\HL.TSE.EntityFramework\EntityFramework\TSEDbContext.cs:line 22 --- End of stack trace from previous location where exception was thrown ---

I am guess the issue is caused by Abp.Zero.EntityFramework, can anyone know how to address it?

This is not a question, it is a share. Today I download a sample project from ABP website, but cannot build it successfully. The build errors are in abp.d.ts, finally I found the typescript version in my local in 1.8, but the sample abp project using the version 2.1 for typescript. So I install the latest version of typescript , and it works. Share to you, maybe you encounter the same issue.

I download the sample project in website. And I can run it successful, but a question here. For the webapi service, the services address is <a class="postlink" href="http://localhost:8080/api/services/app/">http://localhost:8080/api/services/app/</a> like this. And for the login service in weB.MVCController, its address is <a class="postlink" href="http://localhost:8080/account/Login">http://localhost:8080/account/Login</a>. But I found there is webpi.AccountControl, what's the service address of it? I tried <a class="postlink" href="http://localhost:8080/api/services/account/Authenticate">http://localhost:8080/api/services/account/Authenticate</a>, it did not work. Could you let me know? Thanks!

Hi

I create a sample project MyTest in website, but I CANNOT run it If I change the platform from Any CPU TO X64. My computer is Win7 64 bit, and I use Visual Studio 2015 update 2 Please see my step 1 create a sample project named MyTest in website 2 change connection string and db 3 run it with Any CPU, it works fine 4 change Any CPU to x86, it works fine 5 Change Any CPU to x64, an error is returned - "Could not load file or assembly 'MyTst.Application' or one of its dependencies"

Do you have any advice for this issue? Since I have a component must run in x64, so this is important for me, look forward your feedback. Thanks!

The audit log is good, but I would like to log more information for an application service, I would like to user Logger to do it. But I would NOT like to add the following code “Logger.Debug("*****");” for each application service manually. So I would like to know if is there a way to log it like audit log – process it automatically. Or is there a way to extend audit log function?

I define a domain entity as following: public class Order : FullAuditedEntity<long, User>
{

    public string OrderNumber { get; set; }
…

}

I have a service method in application layer as below: public InitReceiveOrderOutput InitReceiveOrder(InitReceiveOrderInput input) { Order order1 = _orderRepository.GetAll() .Include(x=>x.CreatorUser) .FirstOrDefault(x=>x.Id == input.OrderId);

        Order order2 = _orderRepository.GetAll()
           .FirstOrDefault(x => x.Id == input.OrderId);

        return new InitReceiveOrderOutput(order);
    }

After execute Order order1 = _orderRepository.GetAll() .Include(x=>x.CreatorUser) .FirstOrDefault(x=>x.Id == input.OrderId); I would like to get order with CreateUser

After execute Order order2 = _orderRepository.GetAll() .FirstOrDefault(x => x.Id == input.OrderId); I would like to get order without CreateUser

But actually, I found both order1 and order2 with CreateUser, I am not sure why? Do you have any suggestion to get order without CreateUser?

Hi,

Please see following scenario: I mark a field as [required] for a service input, then I invoke this service but do not pass the value of the required field. Then get following response:

{
   "success": false,
   "result": null,
   "error":    {
      "code": 0,
      "message": "Your request is not valid!",
      "details": null,
      "validationErrors": [      {
         "message": "The EstimateStartTime field is required.",
         "members": null
      }]
   },
   "unAuthorizedRequest": false
}

The error message ‘Your request is not valid’ and “The EstimateStartTime field is required” are predefined. How can I implement localization for these predefined error message? Do you have any suggestion?

Showing 1 to 10 of 20 entries