Code Monkey home page Code Monkey logo

simplifynet / simplify.web Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 9.0 12.01 MB

Simplify.Web is an open-source, lightweight, fast and highly customizable server-side .NET web-framework based on ASP.NET Core for building HTTP based web-applications, RESTful APIs etc.

Home Page: https://web.simplifynet.dev

License: GNU Lesser General Public License v3.0

C# 94.52% Smarty 1.07% HTML 0.90% CSS 0.49% JavaScript 0.57% TypeScript 1.65% SCSS 0.70% Dockerfile 0.11%
owin mvc dot-net dot-net-core web-application-framework c-sharp fast simplify backend-framework mono-support

simplify.web's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

simplify.web's Issues

Site path cannot be AppDomain.CurrentDomain.BaseDirectory, it is readonly.

Using mono-service to start a web service, under Debian, led me to modify the new Modules.Environment invocation,

as long, in this case, AppDomain.CurrentDomain.BaseDirectory points a system directory (/usr/lib/mono/4.5), and this property is non-modifable.

So this value cannot be used as the site path.
I prefered to use the current directory instead.

To Reproduce
Steps to reproduce the behavior:

  1. Build a project of your own, embeded in a Windows service, displaying some template result
  2. Use mono-service to lauch the service : mono-service -d:. -l:your.lock your.exe
  3. browse your page : the template is not found, it is searched from /usr/lib/mono/4.5

Expected behavior
The templates are found, because the site path is the current working dirrectory

Desktop:

  • OS: Debian Bullseye

System.ArgumentNullException : Value cannot be null. (Parameter 'language') at Simplify.Web.Modules.Data.FileReader.GetFilePath(String fileName, String language)

System.ArgumentNullException : Value cannot be null. (Parameter 'language') at Simplify.Web.Modules.Data.FileReader.GetFilePath(String fileName, String language)

Steps to reproduce the behavior:
Change target framework of a project using Simplify.Web to .NET 6 and launch it in sdk:6.0-alpine docker container

Expected behavior
No Exceptions

Desktop (please complete the following information):

  • OS: sdk:6.0-alpine docker container

Additional context
More details:
https://github.com/the-benchmarker/web-frameworks/runs/4144664560?check_suite_focus=true
the-benchmarker/web-frameworks#4815

Cannot deserialize query string parameters with camel case to c# objects

Cannot parse query string parameters from request with camelCase, lowercase, etc... to C# object.

Please add verification to query string parsing regardless parameter case.

public static class ListToModelParser
{

	 // some code

	private static string GetBindPropertyName(PropertyInfo propertyInfo)
	{
		var attributes = propertyInfo.GetCustomAttributes(typeof(BindPropertyAttribute), false);

		// verify parameter case
		return attributes.Length == 0 ? null : ((BindPropertyAttribute)attributes[0]).FieldName;
	}
}

Custom ViewModel attribute with own validation logic

Please, add feature with adding custom attribute for viewmodel with custom validation logic.

CustomValidationAttribute should have:

  • bool IsValid method with Value parameter (type object)
  • property string ErrorMessage to response custom error
public class FlightDateValidationAttribute : ValidationAttribute
    {
        public new string ErrorMessage = "Flight date is invalid";
        // or
        public override string Message(){
                  return "Flight date is invalid"; 
        }
        // up to you
        public override bool IsValid(object value)
        {
            var date = value as string;
            return DateTime.TryParse(date, out var flightDate) && flightDate.Date >= DateTime.UtcNow.Date;
        }
    }

In ViewModel:

[FlightDateValidation]
public DateTime FlightDate { get; set; }

or

[FlightDateValidation(ErrorMessage = "Flight date is invalid")] // if message is custom
public DateTime FlightDate { get; set; }

Required, regex attributes don't work in children properties of view model

Required, regex attributes don't invoke in child properties. Ex: If you have User viewmodel with Contacts properties of Contact class, it doesn't work inside Contact properties.

Solution is to make recursion invoke inside viewmodel properties which has this attributes

public class User
{
        [Required]
        public Contact Contact {get;set;}
}

public class Contact
{
        [Required]
        [Regex(@"^[0-9]{9}$")]
        public string Number {get;set;}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.