using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; [Table("Users")] public class User : BaseEntity { public long Id { get; set; } [Required] public string FullName { get; set; } = null!; }
using Microsoft.EntityFrameworkCore; using System.ComponentModel.DataAnnotations.Schema; using System.Reflection; namespace ProjectName.Common.EfHelpers; public static class EfToolkit { /// <summary> /// ایجاد نام موجودیتها /// نام موجودیت اگر اتریبیوت تیبل داشته باشد /// از همان نام استفاده میشود و اگر نداشته باشد /// نامش جمع بسته میشود /// </summary> /// <param name="builder"></param> public static void MakeTableNamesPluralized(this ModelBuilder builder) { var entityTypes = builder.Model.GetEntityTypes(); foreach (var entityType in entityTypes) { // Get the CLR type of the entity var entityClrType = entityType.ClrType; var hasTableAttribute = entityClrType.GetCustomAttribute<TableAttribute>(); // Apply the pluralized table name for the entity if (hasTableAttribute is null) { // Get the pluralized table name var pluralizedTableName = GetPluralizedTableName(entityClrType); builder.Entity(entityClrType).ToTable(pluralizedTableName); } } } /// <summary> /// گرفتن نام تایپ و عوض کردن نام آن از مفرد به جمع /// Singular to plural /// Category => Categories /// Box => Boxes /// Bus => Buses /// Computer => Computers /// </summary> /// <param name="entityClrType"></param> /// <returns></returns> private static string GetPluralizedTableName(Type entityClrType) { // Example implementation (Note: This is a simple pluralization logic and might not cover all cases) var typeName = entityClrType.Name; if (typeName.EndsWith("y")) { // Substring(0, typeName.Length - 1) // Range indexer var typeNameWithoutY = typeName[..^1]; return typeNameWithoutY + "ies"; } if (typeName.EndsWith("s") || typeName.EndsWith("x")) { return typeName + "es"; } return typeName + "s"; } }
protected override void OnModelCreating(ModelBuilder builder) { // it should be placed here, otherwise it will rewrite the following settings! base.OnModelCreating(builder); builder.RegisterAllEntities(typeof(BaseEntity)); builder.MakeTableNamesPluralized(); builder.ApplyConfigurationsFromAssembly(typeof(ApplicationDbContext).Assembly); }
public static class EfToolkit { /// <summary> /// ثبت تمامی انتیتیها /// <param name="builder"></param> /// <param name="type"></param> /// </summary> public static void RegisterAllEntities(this ModelBuilder builder, Type type) { var entities = type.Assembly.GetTypes() .Where(x => x.BaseType == type); foreach (var entity in entities) builder.Entity(entity); } }
- Merge Conflict: "Take Source"/"Keep Target" is missing
- Crashes when trying to debug uwp application
- Unable to select target platform azure v12 for database project
- Fixed crashes or errors that can occur when running Visual Studio after an install action that requires a reboot.
- Fixed an issue deploying Xamarin.Android apps. This peviously required a manual uninstall of the app from the device or emulator.
- This change fixes a bug where the compiler may sometimes incorrectly remove an instruction in a C++ coroutine.
ReactJS is wildly popular and thus wildly supported. TypeScript is increasingly popular, and thus increasingly supported.
The two together? Not as much. Given that they both change quickly, it's hard to find accurate learning materials.
React+TypeScript, with JetBrains IDEs? That three-part combination is the topic of this series. We'll show a little about a lot. Meaning, the key steps to getting productive, in the IDE, for React projects using TypeScript. Along the way, we'll show test-driven development and emphasize tips and tricks in the IDE.
Other videos from this series:
1. Project Setup: https://youtu.be/wm8WdAB64gw
2. Project Cleanup: https://youtu.be/b0KrB31hN5k
3. Testing: https://youtu.be/Y_TGIsFnvo4
4. Debugging Node.js: https://youtu.be/r1kwXZnO8gw
5. Debugging in Chrome: https://youtu.be/dvmZi_DWu9I
6. TSX and ES6: https://youtu.be/JXrZDUzkc2Q
7. Class Props: https://youtu.be/HYmoeUF9ZH0
8. Class State: https://youtu.be/21-VMTmiV8E
9. Rich Events and Testing: https://youtu.be/OO7OmA5UlQM
10. Presentation Components: https://youtu.be/SnCGW6JUo4E
راهنمای ساخت URLهای مناسب
This document covers the best practices and pitfalls for building UI to display URLs in browsers and other apps. It covers the main categories of problems and challenges that we’ve seen in building Chrome. The guidance is intended to be generally applicable, but includes some Chrome-specific notes throughout.
نکات جالبی درباره Breakpoints
Have you ever found a bug in your code and wanted to pause code execution to inspect the problem? If you are a developer, there’s a strong chance you have experienced or will experience this issue many, many times. While the short and sweet answer to this problem is to use a breakpoint, the longer answer is that Visual Studio actually provides multiple kinds of breakpoints and methods that let you pause your code depending on the context! Based on the different scenarios you may experience while debugging, here are some of the various ways to pause your code and set or manage a breakpoint in Visual Studio 2017
GitHub Issues
The GitHub Issues integration allows you to search and reference your issues from the commit message box in VS, in response to this suggestion ticket. You can reference an issue or a pull request by typing # or clicking on the # button in the lower right side of the commit message text box. If you weren't already authenticated to access related issues, you will now be prompted to sign in to take advantage of this feature.
Line Unstaging
To continue improving our line-staging (aka interactive staging) feature, we've added unstage. You can now use the tool tip option to unstage changes, line by line, as requested here Unstage individual lines and hunks in a file - 4 votes
Arm64
We continue to build native support for Arm64 on Windows 11 for the most popular developer scenarios. We now support the .NET Multi-platform App UI (MAUI) workload on Arm64 Visual Studio.
C++
- Available as a preview feature, you can now view Unreal Engine logs without leaving VS. To see the logs from the Unreal Engine Editor, click View > Other Windows > UE Log. To filter your logs, click on the "Categories" or "Verbosity" dropdowns. Since this is an experimental feature, feedback is greatly appreciated.
- You can now import STM32CubeIDE projects for embedded development within Visual Studio with File > Open > Import STM32CubeIDE project. This generates a CMake project with device flashing and debugging settings for STLink. You must have the STM32CubeIDE installed with the board support package for your device. More details available here.
- You can use the new CMake Debugger to debug your CMake scripts at build time. You can set breakpoints based on filenames, line numbers, and when CMake errors are triggered. Additionally, you can view call stacks of filenames and watch defined variables. Currently, this only works with bundled CMake, and projects targeting WSL or remote machines are not supported yet. We are actively working to add more support to the CMake debugger, and feedback is greatly appreciated.
ASP.NET MVC #6
Reason-Phrase = *<TEXT, excluding CR, LF> “The TEXT rule is only used for descriptive field contents and values that are not intended to be interpreted by the message parser. Words of *TEXT MAY contain characters from character sets other than ISO-8859-1 only when encoded according to the rules of RFC 2047”.
البته میشود توسط HttpUtility.UrlEncode این پیام را encode و در سمت کلاینت توسط مثلا jQuery با استفاده از متد استاندارد decodeURIComponent آنرا دریافت کرد ولی ... به صورت پیش فرض و encode نشده، تفسیر نمیشود و حتی به عنوان یک هدر مخرب شاید برگشت زده شود.