I am studying the Documents/Developing-Step-By-Step-Angular. The GetPeopleInput class contains only one string type filter, and the Angular UI adds a string value as a parameter in url. In my application, the search criteria contain multiple filters like a complex object. For example:
criteriaObj: { filter1: string, filter2: date, filter3: [ {}, {} ] }
I wonder what is the best practice to handle such filter object in ASP.NET Zero projects? Do you have an example about it?
Thanks,
I need to create an entity with an existing table, so I have to use the existing column name, especially the prime key column. That means I cannot inherit the FullAuditedEntity, otherwise, it will add a key column “Id” and other predefined columns. The problem happens while I create the AppService on the IRepository<TEntity>. It seems that the TEntity must inherit the FullAuditedEntity. Otherwise, there is a compile error:
There is no implicit reference conversion from ‘Custom-Type’ to ‘Abp.Domain.Entities.IEntity<int>’.
Here is my sample code for Entity. The table “Customers” is an existing table with a prime key “SCM_ID”. I have to remove the “FullAuditedEntity”:
[Table("Customers")]
public class Customer //: FullAuditedEntity
{
public const int MaxNameLength = 32;
[Required]
[Key]
public int SCM_ID { get; set; }
[MaxLength(MaxNameLength)]
public virtual string SCM_Name { get; set; }
}
Here is my sample code for AppService:
public class CustomerAppService : MyAppServiceBase, ICustomerAppService
{
private readonly IRepository<Customer> _customerRepository; //ERRORS HERE!!
public ListResultDto<CustomerListDto> GetCustomers(GetCustomersInput input)
{
var customers = _customerRepository
.GetAll()
.ToList();
return new ListResultDto<CustomerListDto>(ObjectMapper.Map<List<CustomerListDto>>(customers));
}
}
The compile error is on the line of “IRepository<Customer>”:
The type ‘…Customer’ cannot be used as type parameter ‘TEntity’ in the generic type or method ‘IRepository<TEntity>’. There is no implicit reference conversion from ‘…Customer’ to ‘Abp.Domain.Entities.IEntity<int>’
I tried to force the Entity and the ListDto class to inherit the “FullAuditedEntity”. It can pass the compile, but it has an error on run-time: the “_customerRepository” seems never assigned to and always null.
Please advise a correct way for entities with existing database table.
Thanks,
I am following "Developing-Step-By-Step-Angular" to add my own application. I want to keep all built-in functions in "default" database and store my own application data in a separated database.
I added another ConnectionString in appsettings.json, like { "ConnectionStrings":{"Default": "//default string", "AppData":"//application string"}, ......}
I wonder what is the best practice to use the separated connection "AppData". For example in "Creating Person Entity" step, how do I reference the connectionString to create [Table("PbPersons")] into "AppData" database?
Actually, the "AppData" database and tables exist already. I don't need to migrate/seed. I just need to map the schema from existing table to Person entity. Please advise!
Thanks,
The "Name" on Sign up page is confused users in USA. They use "First Name". So, I added a new language "English (United States)" on Administration > Languages page, and then, change its texts (Key=Name) from "Name" to "First Name". It works fine on user sign up page, but it seems that all "Name" now show as "First Name". For example, the language name column now shows "First Name" on column header.
It is not a big deal for now between "English" and "English (United States)", but it rises me a question. While adding on my own application modules, how do I add language texts with a new Key? :?:
If I need to modify the code for this, can you advise where are the related code files?
Thank you!
I am trying v4.0 (Core+Angular), and a little confused about "Default Language".
On Administration > Languages page, there is a column with header of "Default*". All of original 10 languages show "Yes". On the bottom of this page, there is a note:"* Can not edit or delete default languages." I guess the "Default Languages" here means "Built-in languages". Am I correct? :?: If so, where is it marked as "Default Languages"? :?: I checked AbpLanguages table, and no clue which column is for "default". Ultimately, is it possible to hide specific languages to users (remove from the dropdown)? :?:
In the "Actions" dropdown, there is an option "Set as default language". If I set a specific language "as default" here, the language name is modified by ending with "(Default)", but what does it affect? :?: I tried to login with another user or re-login with Admin, and nothing changed. The language is still English.
On the top bar, I tried to select a language other than English. It changes the font on screen after an automatic refresh, which is correct. However, if the user login next time on another machine or browser, the "Default" language is still English. Is it possible to remember the user's choice of "default" language? :?:
Thanks,
I am trying v4.0 (Core+Angular). On release mode, I set SMTP with the one on the same Web host server, and send test email successfully. However, the emails are always stuck in \mailroot\Queue, and ultimately into \mailroot\Badmail. I tried to test with several email addresses, but got same thing. The *.BAD files always contains same error message: "Delivery to the following recipients failed." :(
I tried to use SMTP on another server, but got "An internal error occurred during your request". The log text is: System.NotSupportedException: The SMTP server does not support authentication.
Any clue?
Thanks,
I’m trying version 4.0 (Core + Angular), and got some difficulties on registering new users. Here are my questions:
On localhost, I tried to use “CREATE ACCOUNT” on Login page. It pops up a “Sign up” form. After filling up all info, check off “I’m not a robot”, and click “Submit” button, I got an error “An internal error occurred during your request!” What I missed?
On release mode, according to Documents/Development-Guide-Angular, I need to replace reCAPTCHA keys in appsettings.json file in the server side and in the register.component.html in the client side. I can easily replace a site key on server side appsettings.production.json, but I cannot find the “register.component.html” in client side “dist” folder. Do I need to replace the key on original “register.component.html” and publish it again?
As the document, “Recaptcha (security question) is optional”. How do I disable “Recaptcha”?
There seem two ways to add new users. One is by user self from “CREATE ACCOUNT” on Login page, and one is by Admin from “CREATE NEW USER” from Administration > Users page. How do I block users from creating account by themselves?
In case of allowing users creating account by themselves, how to assign a default Role or make inactive until admin grants the access?
Thanks,
I just downloaded v4.0. While run it, I got exceptions of "invalid column name 'ConcurrencyStamp'" and "invalid column name 'NormalizedName'". I think v4.0 changed the database schema and I didn't migrate it again. Because my old database already contains some data, I like to compare the changes and manually repair the database table, if it is not too hard.
How do I find the breaking changes in version 4.0? For example, I want to know which table contains column "ConcurrencyStamp". I went to Github repository, but cannot find it.
Please advise.
Thanks,
I used version 3.3.0 and uploaded my logo file a month ago. I wonder where it is stored?
Recently, I download version 3.4.0 and started my project from scratch. When I start run it at first time, my old logo showed on the Login page. I know I can still use it or overwrite it by uploading a new logo again, but I want to know how it happens. I searched the whole package, but no clue.
Can you tell me where the logo file is stored?
Thanks,
I am trying "ASP.NET Core & Angular 2.x" v3.3.0. It runs fine on localhost. I am going to deploy it on IIS in our Production server, but I couldn't find instructions in document how to change database on different environment.
On my other projects, I usually list all connectionStrings in appSettings.json, e.g. "connectionStrings": { "developmentConnectionString": "Server=(localdb)\mssqllocaldb;Database=ProjectDB;Trusted_Connection=True;", "productionConnectionString": "Server=ProductionSQL;Database=ProjectDB1;Trusted_Connection=True;" } and use Environment Variable to automatically inject a proper connectionString for development on localhost or production server.
Can you advise me how to implement the similar (or better) way in ASP.NET Zero solution? :?:
Also, on "Getting Started" guide, Database Migrations section, it states: AspNet Zero solution includes a .Migrator (like Acme.PhoneBook.Migrator) project in the solution. You can run this tool for database migrations on development and production(see <ins>development guide</ins> for more information).
I am confused how to "run this tool". I followed the link to "development guide", but couldn't find the section to "run this tool". Can you give me a clue to get more detail instruction? :?:
On my development machine, I use "Entity Framework Migration Command" to create the database and seed it. I wonder how to use it on production environment. :?:
Thanks,