Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

MicroLite 7.0.0

Latest
Compare
Choose a tag to compare
@TrevorPilley TrevorPilley released this 27 Mar 10:19
8b89888

MicroLite 7.0.0 contains a number of changes over 6.3.4:

  • The library is now .NET 4.5 only, the .NET 3.5, 4.0 and 4.6 builds have been removed
  • The library is now using the .NET Standard project format, tests are now .NET 4.8 and xUnit 2.4.1
  • Build is migrated to Azure DevOps YAML
  • Code style updated using .editorconfig and enforced via StyleCop
  • C# 7.3 language features (Expression bodied members, Pattern Matching, Throw expressions etc.)
  • Added SecurityCodeScan and SonarAnalyzer.CSharp Roslyn analyzer packages to ensure code quality
  • Breaking Change The API is now Async only, the IAsync..Session interfaces are removed and the I...Session interfaces now only contain the async methods
  • Breaking Change SqlServer CE support removed

The following issues have been resolved:

  • #484 - Select builder adds extra parenthesis

Upgrade Scenarios

Using .NET 3.5 or 4.0

Remain on MicroLite 6.3.4 until you can migrate to .NET 4.5 or later.

Using SQL Server Compact Edition

Remain on MicroLite 6.3.4 until you can migrate to an alternative database (e.g. SQLite).

Using .NET 4.5 or later and not currently using Async sessions

  • Update to MicroLite 7.0
  • Update to use async versions of ISession/IReadOnlySession interfaces
  • e.g. var customer = session.Single(123); => var customer = await session.SingleAsync(123);

Using .NET 4.5 or later and already using Async sessions

  • Update to MicroLite 7.0, find and replace:
    • IAsyncSession with ISession
    • IAsyncReadOnlySession with IReadOnlySession
    • IAdvancedAsyncSession with IAdvancedSession
    • IAdvancedAsyncReadOnlySession with IAdvancedReadOnlySession
    • OpenAsyncSession() with OpenSession()
    • OpenAsyncReadOnlySession() with OpenReadOnlySession()

The following API changes exist MicroLite 6.3.4 to 7.0.0

MicroLite

- public interface IAdvancedAsyncReadOnlySession
- public interface IAdvancedAsyncSession
- public interface IAsyncReadOnlySession
- public interface IAsyncSession
- public interface IHideObjectMethods

IAdvancedReadOnlySession

- void ExecutePendingQueries();
+ Task ExecutePendingQueriesAsync();
+ Task ExecutePendingQueriesAsync(CancellationToken cancellationToken);

IAdvancedSession

- bool Delete(Type type, object identifier);
- T ExecuteScalar<T>(SqlQuery sqlQuery);
- bool Update(ObjectDelta objectDelta);
+ Task<bool> DeleteAsync(Type type, object identifier);
+ Task<bool> DeleteAsync(Type type, object identifier, CancellationToken cancellationToken);
+ Task<int> ExecuteAsync(SqlQuery sqlQuery);
+ Task<int> ExecuteAsync(SqlQuery sqlQuery, CancellationToken cancellationToken);
+ Task<T> ExecuteScalarAsync<T>(SqlQuery sqlQuery);
+ Task<T> ExecuteScalarAsync<T>(SqlQuery sqlQuery, CancellationToken cancellationToken);
+ Task<bool> UpdateAsync(ObjectDelta objectDelta);
+ Task<bool> UpdateAsync(ObjectDelta objectDelta, CancellationToken cancellationToken);

IReadOnlySession

- IList<T> Fetch<T>(SqlQuery sqlQuery);
- PagedResult<T> Paged<T>(SqlQuery sqlQuery, PagingOptions pagingOptions);
- T Single<T>(object identifier) where T : class, new();
- T Single<T>(SqlQuery sqlQuery);
+ Task<IList<T>> FetchAsync<T>(SqlQuery sqlQuery);
+ Task<IList<T>> FetchAsync<T>(SqlQuery sqlQuery, CancellationToken cancellationToken);
+ Task<PagedResult<T>> PagedAsync<T>(SqlQuery sqlQuery, PagingOptions pagingOptions);
+ Task<PagedResult<T>> PagedAsync<T>(SqlQuery sqlQuery, PagingOptions pagingOptions, CancellationToken cancellationToken);
+ Task<T> SingleAsync<T>(object identifier) where T : class, new();
+ Task<T> SingleAsync<T>(object identifier, CancellationToken cancellationToken) where T : class, new();
+ Task<T> SingleAsync<T>(SqlQuery sqlQuery);
+ Task<T> SingleAsync<T>(SqlQuery sqlQuery, CancellationToken cancellationToken);

ISession

- bool Delete(object instance);
- void Insert(object instance);
- bool Update(object instance);
+ Task<bool> DeleteAsync(object instance);
+ Task<bool> DeleteAsync(object instance, CancellationToken cancellationToken);
+ Task InsertAsync(object instance);
+ Task InsertAsync(object instance, CancellationToken cancellationToken);
+ Task<bool> UpdateAsync(object instance);
+ Task<bool> UpdateAsync(object instance, CancellationToken cancellationToken);

ISessionFactory

- IAsyncReadOnlySession OpenAsyncReadOnlySession();
- IAsyncReadOnlySession OpenAsyncReadOnlySession(ConnectionScope connectionScope);
- IAsyncSession OpenAsyncSession();
- IAsyncSession OpenAsyncSession(ConnectionScope connectionScope);

Configuration

ConfigurationExtensions

- public static ICreateSessionFactory ForSqlServerCeConnection(this IConfigureConnection configureConnection, string connectionName)
- public static ICreateSessionFactory ForSqlServerCeConnection(this IConfigureConnection configureConnection, string connectionName, string connectionString, string providerName)

Infrastructure

- public interface IHaveAsyncReadOnlySession
- public interface IHaveAsyncSession

IHaveReadOnlySession

- IReadOnlySession Session { get; set; }
+ IReadOnlySession Session { get; }

IHaveSession

- ISession Session { get; set; }
+ ISession Session { get; }

view code changes