Code Monkey home page Code Monkey logo

simplifynet / simplify Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 8.0 10.8 MB

Simplify is an open-source set of lightweight .NET libraries that provide infrastructure for your applications. DI and mocking friendly.

Home Page: https://simplifynet.dev

License: GNU Lesser General Public License v3.0

PowerShell 0.19% C# 99.77% Smarty 0.01% Dockerfile 0.04%
simplify dot-net dot-net-core mono-support c-sharp smtp-client windows-services dependency-injection ioc-container repository-pattern

simplify's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar dinmukhamed09 avatar hardcoder avatar i4004 avatar waffle-iron avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

simplify's Issues

Extend ObservableCollection with AddRange and RefreshItems methods

Is your feature request related to a problem? Please describe.

  1. ObservableCollection does not contain AddRange method, but has Add method.
  2. It also does not raise an event on item change, just only on item addition/removal.

Describe the solution you'd like

  1. Add extension method AddRange
  2. Add extension method RefreshItems

Describe alternatives you've considered

Additional context

Add TransactGenericRepository

  • All methods should be wrapped to explicit transactions
  • Add check that if transaction is open then BeginTransaction and Commit should be skipped
  • IsolationLevel should be set in constructor

Add records support for base classes in GenericRepository

Is your feature request related to a problem? Please describe.
Could not inherit record type from class.

Describe the solution you'd like
For example, inherit CustomRecord from IdentityRecord.

Describe alternatives you've considered
Just a new record type, delivered with C# 9.0.

Additional context

Add project Simplify.AutoMapper with few extension methods

Is your feature request related to a problem? Please describe.
AutoMapper is a great mapping/validation tool. It delivers conventional mapping that provides mappings with just one line of code.
But there are some usecases when we need to write complex mappings with ton of properties using ForMember method. As a result there are large source files with low readability.

Describe the solution you'd like
To write simple mapping rule for some property, we use following code: ForMember(dest => dest.X, opt => { opt.MapFrom(src => src.X); ... })
Alternatively, we can write something like:
Map(dest => dest.X, src => src.X, opt => ...) with options enabled,
or Map(dest => dest.X, src => src.X) when there is no need for custom options,
or Map(dest => dest.X) when destination member is mapped directly from source object.

Describe alternatives you've considered

Additional context

Extend the XElement class with shortcut and extension methods

Is your feature request related to a problem? Please describe.

  1. Using system derived namespace System.Xml.XPath, we can get elements by methods XPathSelectElement and XPathSelectElements.
    It is hard to read the code with tons of that methods, for example when parsing large Xml document.
  2. We cannot use local variables that store temporary XElement objects, in expressions, for example in AutoMapper mapping expression.
    Need to define Func<XElement,XElement> to use it in expressions.

Describe the solution you'd like

  1. Add shortcut extension methods for XElement methods:
  • "Get" for XPathSelectElement
  • "GetList" for XPathSelectElements
  1. Add extension method that will return Func<XElement, XElement>.

Add WeakSingleton class to Simplify.System

Is your feature request related to a problem? Please describe.
Simple singleton can be implemented via private property _instance and a public one named Instance. Once created, it holds reference to the targeted object over application lifetime until termination.
WeakReference can be used in cases when there is no need to hold object reference over long time. Its target can be deleted with garbage collector in short period of time. Correct implementation of Singleton over WeakReference is not hard but repeatitive.

Describe the solution you'd like
Implement WeakSingleton that holds singleton logic over WeakReference.

Describe alternatives you've considered
Dependency injection is a great alternative and a preferred one. But in cases where there is no DI in some projects and importing DI features to those projects is painful or just overhead, it is useful to have that sort of custom singleton implementation,

Stopwatch class with ability to add existing value to elapsed time

Specification:

public OffsetStopwatch(TimeSpan startOffset = default)
{
	StartOffset = startOffset;
}

public TimeSpan StartOffset { get; }

public TimeSpan Elapsed => throw new NotImplementedException();
public long ElapsedMilliseconds => throw new NotImplementedException();
public long ElapsedTicks => throw new NotImplementedException();

public new static OffsetStopwatch StartNew()
{
	throw new NotImplementedException();
}

UpdateSchema extension method for FluentConfiguration

Is your feature request related to a problem? Please describe.

Current schema update script looks like this

[Test]
public void UpdateSchema()
{
	var configuration = new MySessionFactoryBuilder(/* IConfiguration */)).CreateConfiguration();

	Configuration config = null;
	configuration.ExposeConfiguration(c => config = c);
	configuration.BuildSessionFactory();

	config.CreateIndexesForForeignKeys();

	var updater = new NHibernate.Tool.hbm2ddl.SchemaUpdate(config);
	updater.Execute(true, true);
}

Describe the solution you'd like
This code can be moved to Simplify.FluentNHibernate as an extension method for FluentConfiguration with ability to extend Configuration

Add concurrency to the ObservableCollection

Is your feature request related to a problem? Please describe.
ObservableCollection does not work properly in concurrent mode. It raises events on items addition/removal, that are not handled by watchers, if collection is changed asynchronously / on another thread.

Describe the solution you'd like
Add class ConcurrentObservableCollection, that inherits ObservableCollection and adds concurrency feature.

Describe alternatives you've considered

Additional context

Fluent interfaces for registration methods

Before

DIContainer.Current.Register<IBar, Bar>();
DIContainer.Current.Register<IFoo, Foo>();
DIContainer.Current.Register<IBar>(p => new Bar2("test"));

After

DIContainer.Current.Register<IBar, Bar>()
    .Register<IFoo, Foo>()
    .Register<IBar>(p => new Bar2("test"));

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.