کتابخانه At.js
- Support IE 7+ for textarea.
- Supports HTML5 contentEditable elements (NOT including IE 8)
- Can listen to any character and not just '@'. Can set up multiple listeners for different characters with different behavior and data
- Listener events can be bound to multiple inputors.
- Format returned data using templates
- Keyboard controls in addition to mouse
-
Tab
orEnter
keys select the value -
Up
andDown
navigate between values (andCtrl-P
andCtrl-N
also) -
Right
andleft
will re-search the keyword.
-
- Custom data handlers and template renderers using a group of configurable callbacks
- Supports AMD
A library that provides a simple way to create lambda expressions to filter lists and database queries.
var filter = new Filter<Person>(); filter.By("Id", Operation.Between, 2, 4, Connector.And); filter.By("Contacts[Value]", Operation.EndsWith, "@email.com", default(string), Connector.And); filter.By("Birth.Country", Operation.IsNotNull, default(string), default(string), Connector.Or); filter.By("Name", Operation.Contains, " John"); var people = People.Where(filter); //or like this... var filter = new Filter<Person>(); filter.By("Id", Operation.Between, 2, 4) .And.By("Birth.Country", Operation.IsNotNull) .And.By("Contacts[Value]", Operation.EndsWith, "@email.com") .Or.By("Name", Operation.Contains, " John "); var people = People.Where(filter);
So that would generate an expression like this:
People.Where(p => (p.Id >= 2 && p.Id <= 4) && (p.Birth != null && p.Birth.Country != null) && (p.Contacts != null && p.Contacts.Any(c => c.Value.Trim().ToLower().EndsWith("@email.com"))) || (p.Name != null && p.Name.Trim().ToLower().Contains("john")));
The Intersection of Microservices, Domain-Driven Design and Entity Framework Core
Domain-Driven Design (DDD) provides much of the strategic design guidance that we can use to determine the boundaries around and interactions between Microservices in our solutions. DDD also follows up with tactical design patterns for your business logic. In this session we'll take a look at some of these patterns and how EF Core naturally, or with some additional configuration, persists the data that your microservices depend on.
ReScript زبان پس از TypeScript؟
In the confusing jungle of transpiler languages for JavaScript, there are some gems. TypeScript is mainstream, ReScript is starting to establish itself, and Elm is still an insider tip. This article takes a detailed look at ReScript – but also sheds light on the limitations of the young language. In what projects does its use make sense? What projects should rather use TypeScript on the one hand or Elm on the other?
In this section, I’m going to cover how you can use SignalR outside of a Hub. In most asp.net core applications, you will likely want to communicate with the connect clients from within your application but outside of a Hub. You can accomplish this by using the HubContext.
For example, an ASP.NET Core MVC Controller or any other class that is instantiated by ASP.NET Core’s Dependency Injection.
The HubContext allows you to send messages to your connected clients. It has many of the same features to communicate with clients as when you are inside of a Hub.
ASP.NET Core offers attributes such as [HttpGet] and [HttpPost] that allow you to restrict the HTTP verbs used to invoke an action. You can also use HttpRequest object's Method property to detect the HTTP verb behind the current request. However, at times you need to know whether a request is an Ajax request or not. You may also need to restrict an action only to Ajax calls. Although thee is no inbuilt way to accomplish this task, you can easily implement such a feature in your application. This article discusses how.
Fill and FillByObject
/// <summary> /// Insert values from an object into a string pattern. To specify the object's property you have to use the '{propertyName}'. /// </summary> /// <remarks> /// This method is a replacement to String.Format, but it has two differences: /// <list type="simple"> /// <item>It reverese the order you call the functionality, instead of writing String.Format(pattern, args) you write pattern.FillByObject(args). This makes the code look cleaner.</item> /// <item>You supply the pattern with an object and specify insertion points by property names.</item> /// </list> /// <example> /// <![CDATA[ /// "First name:{firstName}, Sur name:{Surname}".FillByObject(new {firstName = "Sam", lastName="Naseri"}); /// ]]> /// </example> /// </remarks> /// <seealso cref="Fill"/> /// <typeparam name="T">Type of bindingValue.</typeparam> /// <param name="bindingPattern">The pattern to fill.</param> /// <param name="bindingValue">The object providing values to fill in the pattern.</param> /// <returns>The pattern filled with values.</returns> public static string FillByObject<T>(this string bindingPattern, T bindingValue) { var properties = GetProperties(typeof(T)).ToList(); var values = properties.Select(property => property.GetValue(bindingValue, new object[] { })).ToList(); var result = bindingPattern; for (int index = 0; index < properties.Count; index++) { var property = properties[index]; var propPattern = "{" + property.Name + "}"; var old = result; result = result.Replace(propPattern, values[index] != null ? values[index].ToString() : ""); } return result; }
private static IEnumerable<PropertyInfo> GetProperties(Type t) { return t.GetProperties(BindingFlags.Public | BindingFlags.Instance); }
/// <summary> /// A simple replacement for String.Format which only makes the codes look nicer. /// </summary> /// <param name="pattern">The source string that you want to replace insertion points on it.</param> /// <param name="args">Values to be replaced in the pattern.</param> /// <returns></returns> public static string Fill(this string pattern, params object[] args) { return string.Format(pattern, args); }
چند اصل مهم توسعه نرم افزار
از نگارش ASP.NET Core 2.1 preview 2 به بعد، کامپایلر ASP.NET Core، فایلهای Razor را هم در حین کامپایل برنامه به صورت خودکار بررسی میکند (Razor compilation on build). برای نمونه اگر model@ تعریف شدهی در یک فایل razor حاوی خاصیت مورد استفاده نباشد، در حین کامپایل برنامه، خطای مرتبط با آن فایل cshtml را میتوان مشاهده کرد:
Views\UploadFileExtensions\Index.cshtml(25,135): error CS1061: 'UserFileViewModel' does not contain a definition for 'UserFile' and no extension method 'UserFile' accepting a first argument of type 'UserFileViewModel' could be found (are you missing a using directive or an assembly reference?)