Input Validation for me is about validating the user input. Some people call "Name must not be empty" a business rule, I think about it as input validation. Business Rules validation is more complex, because a business rule for me is not "Name must not be empty", it is a definition of a state in the system that requires an action. Here is a definition of a business rule:
An order should be payed within 30 days, this duration can be extended, to a maximum of three times.
بررسی Visual Studio 2022 Preview 1
Visual Studio 2022 Preview 1 was released recently. While normally I hold off on talking about preview releases and other items that are going to change rapidly like .NET 6, I think it is important to know what VS2022 is all about so you know what to expect in the coming months. So in this video, we are going to see VS2022 in action, we will see what the new features are, and we will talk about what this means for VS2019.
نحوه پیکربندی و استفاده از PostgreSQL در Entity Framework Core
Npgsql has an Entity Framework (EF) Core provider. It behaves like other EF Core providers (e.g. SQL Server), so the general EF Core docs apply here as well. If you're just getting started with EF Core, those docs are the best place to star
Development happens in the Npgsql.EntityFrameworkCore.PostgreSQL repository, all issues should be reported there
کتابخانه jquery-tocanvas
Microsoft has released April Patch Tuesday, security updates with a total of 108 vulnerabilities in the family of Windows operating systems and related products. In the release by Microsoft, 19 were rated as Critical and 89 as Important. Six Chromium Edge vulnerabilities released earlier this month have not been included in these numbers.
12 سال کار، 12 درس
I’ve been at ThoughtWorks for 12 years. Who would have imagined? Instead of writing about my reflections from the past year, I thought I would do something different and post twelve key learnings and observations looking back over my career. I have chosen twelve, not because there are only twelve, but because it fits well with the theme of twelve years.
تبدیلگر تاریخ شمسی برای AutoMapper
Type 'System.String' does not have a default constructor Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentException: Type 'System.String' does not have a default constructor
من به این صورت نوشتم :
CreateMap<DateTime, string>().ConvertUsing(new DateTimeToPersianDateTimeConverter()); CreateMap<User, UserViewModel>();
این هم model و viewmodel :
public class User : IdentityUser<long, UserLogin, UserRole, UserClaim> { public virtual DateTime RegisterDate { get; set; } // bla bla }
public class UserViewModel { public string RegisterDate { get; set; } }
public List<UserViewModel> GetUsersByPage(int pageNumber, string pagerSortBy, string pagerSortOrder, string term, out int records, int recordsPerPage) { //bla bla bla return users.Skip(skipRecords) /*این خط خطا داره*/ .Take(recordsPerPage) .Project(_mappingEngine).To<UserViewModel>().Future().ToList(); }
ولی وقتی اینطوری استفاده میکنم خطا نمیده ولی خب به درد نمیخوره. من میخوام تبدیلش کنم به فارسی :
CreateMap<User, UserViewModel>() .ForMember(d => d.RegisterDate, m => m.MapFrom(s => s.RegisterDate.ToString()));
ممنون میشم راهنمایی کنید.
“My browser lost its cookies” has long been one of the most longstanding Support complaints in the history of browsers. Unfortunately, the reason that it has been such a longstanding issue is that it’s not the result of a single problem, and if the problem is intermittent (as it often is), troubleshooting the root cause may be non-trivial.
It’s time to get serious about improving your programming skills. Let’s do it!
That’s an easy career improvement goal to give oneself, but “become a kick-$!! programmer” is not a simple goal. For one thing, saying, “I want to get better” assumes that you recognize what “better” looks like. Plus, too many people aim for improvement without any sense of how to get there.