GithubHelp home page GithubHelp logo

henkmollema / dommel Goto Github PK

View Code? Open in Web Editor NEW
538.0 27.0 94.0 2.52 MB

CRUD operations with Dapper made simple.

License: MIT License

C# 99.28% Batchfile 0.08% PowerShell 0.64%
dapper query-builder crud dommel micro-orm sql-expression

dommel's Introduction

Dommel

CRUD operations with Dapper made simple.

Windows Linux NuGet MyGet Test Coverage
AppVeyor Travis NuGet MyGet Pre Release codecov

Dommel provides a convenient API for CRUD operations using extension methods on the IDbConnection interface. The SQL queries are generated based on your POCO entities. Dommel also supports LINQ expressions which are being translated to SQL expressions. Dapper is used for query execution and object mapping.

There are several extensibility points available to change the behavior of resolving table names, column names, the key property and POCO properties. See Extensibility for more details.

Installing Dommel

Dommel is available on NuGet.

Install using the .NET CLI:

dotnet add package Dommel

Install using the NuGet Package Manager:

Install-Package Dommel

Using Dommel

Retrieving entities by ID

var product = await connection.GetAsync<Product>(1);

Retrieving all entities in a table

var products = await connection.GetAllAsync<Product>();

Selecting entities using a predicate

Dommel allows you to specify a predicate which is being translated into a SQL expression. The arguments in the lambda expression are added as parameters to the command.

var products = await connection.SelectAsync<Product>(p => p.Name == "Awesome bike" && p.Created < new DateTime(2014, 12, 31) && p.InStock > 5);

Which would translate in the following SQL:

select * from Products where Name = @p1 and Created < @p2 and InStock > @p3

You can add parentheses to combine and & or queries:

var products = await connection.SelectAsync<Product>(p => p.Name == "Awesome bike" && (p.Created < new DateTime(2014, 12, 31) || p.InStock > 5));

Which would translate in the following SQL:

select * from Products where Name = @p1 and (Created < @p2 or InStock > @p3)

There is also a FirstOrDefaultAsync<T>(...) method available to select the first entity matching the predicate.

Like-queries

It is possible to generate LIKE-queries using Contains(), StartsWith() or EndsWith() on string properties:

var products = await connection.SelectAsync<Product>(p => p.Name.Contains("bike"));
var products = await connection.SelectAsync<Product>(p => p.Name.StartsWith("bike"));
var products = await connection.SelectAsync<Product>(p => p.Name.EndsWith("bike"));

Inserting entities

var product = new Product { Name = "Awesome bike", InStock = 4 };
var id = await connection.InsertAsync(product);

Updating entities

var product = await connection.GetAsync<Product>(1);
product.Name = "New name";
await connection.UpdateAsync(product);

Removing entities

var product = await connection.GetAsync<Product>(1);
await connection.DeleteAsync(product);

Multi mapping

One-to-one relations

Dommel is able to generate join-queries based on the specified multi mapping function. Consider the following POCO's:

public class Product
{
    public int Id { get; set; }

    public string Name { get; set; }

    // Maps to the foreign key column
    public int CategoryId { get; set; }

    // The navigation property
    public Category Category { get; set; }
}


public class Category
{
    public int Id { get; set; }

    public string Name { get; set; }
}

The Product with its associated Category can be queried toegether using the Get<T1, T2, ..., TResult>() method:

var product = await product.GetAsync<Product, Category, Product>(1, (product, category) =>
{
    product.Category = category;
    return product;
});
Foreign key columns

CategoryId is automatically used as foreign key between Product and Category. This follows a simple convention: joining table name + Id (Category + Id). You can override this behavior by using the [ForeignKey("ForeignKeyColumnName")] attribute or by implementing your own IForeignKeyPropertyResolver.

One-to-many relations

One-to-many relationships work in a similar way, expect that the foreign key is defined on the joined type rather than the source type. For example:

public class Order
{
    public int Id { get; set; }

    // The navigation property
    public ICollection<OrderLine> OrderLines { get; set; } = new List<OrderLine>();
}

public class OrderLine
{
    public int Id { get; set; }

    // The foreign key column to the Order table
    public int OrderId { get; set; }

    public string Description { get; set; }
}

The Order with its child OrderLine's can be queried toegether using the Get<T1, T2, ..., TResult>() method:

var product = await product.GetAsync<Order, OrderLine, Order>(1, (order, line) =>
{
    // Naive mapping example, in reality it requires more gymnastics
    order.OrderLines.Add(line);
    return order;
});

Automatic multi mapping

Note: this is an experimental feature.

Dommel is able to create simple join-expressions for retrieving parent-child entities. One-to-one and one-to-many relations are supported. It works the samy way as regular mapping, except there is no need to specify a function which performs the mapping of the objects. Using the same POCO's as the previous examples:

Retrieving a Product and its associated Category:

var product = product.Get<Product, Category, Product>(1);

Retrieving one Order and with its child OrderLine's:

var product = product.Get<Order, OrderLine, Order>(1);

Entity equality

When joining with two or more tables with a one-to-many relationship, you are required to override Equals(object obj) method or implement the IEquatable<T> interface on your POCO's so Dommel can determine whether an entity is already added to the collection. For example:

public class OrderLine : IEquatable<OrderLine>
{
    public int Id { get; set; }

    public int OrderId { get; set; }

    public string Description { get; set; }

    public bool Equals(OrderLine other) => Id == other.Id;
}

Combining Select and multi-mapping

It's possible to combine Select queries and multi-mapping. For example:

var products = await connection.SelectAsync<Product, Category, Product>(x => x.Name.StartsWith("bike"));

This is applicable for Select, SelectAsync, FirstOrDefault and FirstOrDefaultAsync. Both with manual and automatic multi-mapping.

From-queries

With From-queries you can create more complex queries on a certain table by providing access to the SqlExpression<T>. For example:

var products = await connection.FromAsync<Product>(sql => sql
    .Where(x => x.Name.StartsWith("bike") && x.DeletedOn == null)
    .OrWhere(x => x.InStock > 5)
    .OrderBy(x => x.DateCreated)
    .Page(1, 25)
    .Select()));

Async and non-async

All Dommel methods have async and non-async variants, such as as Get & GetAsync, GetAll & GetAllAsync, Select & SelectAsync, Insert & InsertAsync, Update & UpdateAsync, Delete & DeleteAsync, etc.

Query builders

Dommel supports building specialized queries for a certain RDBMS. By default, query builders for the following RDMBS are included: SQL Server, SQL Server CE, SQLite, MySQL and Postgres. The query builder to be used is determined by the connection type. To add or overwrite an existing query builder, use the AddSqlBuilder() method:

DommelMapper.AddSqlBuilder(typeof(SqlConnection), new CustomSqlBuilder());

Extensibility

ITableNameResolver

Implement this interface if you want to customize the resolving of table names when building SQL queries.

public class CustomTableNameResolver : ITableNameResolver
{
    public string ResolveTableName(Type type)
    {
        // Every table has prefix 'tbl'.
        return $"tbl{type.Name}";
    }
}

Use the SetTableNameResolver() method to register the custom implementation:

SetTableNameResolver(new CustomTableNameResolver());

IKeyPropertyResolver

Implement this interface if you want to customize the resolving of the key property of an entity. By default, Dommel will search for a property with the [Key] attribute, or a column with the name 'Id'.

If you, for example, have the naming convention of {TypeName}Id for key properties, you would implement the IKeyPropertyResolver like this:

public class CustomKeyPropertyResolver : IKeyPropertyResolver
{
    public ColumnPropertyInfo[] ResolveKeyProperties(Type type)
    {
        return new [] { new ColumnPropertyInfo(type.GetProperties().Single(p => p.Name == $"{type.Name}Id"), isKey: true) };
    }
}

Use the SetKeyPropertyResolver() method to register the custom implementation:

DommelMapper.SetKeyPropertyResolver(new CustomKeyPropertyResolver());

IForeignKeyPropertyResolver

Implement this interface if you want to customize the resolving of the foreign key property from one entity to another. By default Dommel will search for a property of {TypeName}Id or the column name specified using the [ForeignKey] attribute.

This is a rather advanced interface. Providing your own implementation requires quite some knowledge of the way Dommel handles foreign key relationships. Consider subclassing DefaultForeignKeyPropertyResolver and override ResolveForeignKeyProperty().

Use the SetForeignKeyPropertyResolver() method to register the custom implementation:

DommelMapper.SetForeignKeyPropertyResolver(new CustomForeignKeyPropertyResolver());

IColumnNameResolver

Implement this interface if you want to customize the resolving of column names for when building SQL queries. This is useful when your naming conventions for database columns are different than your POCO properties.

public class CustomColumnNameResolver : IColumnNameResolver
{
    public string ResolveColumnName(PropertyInfo propertyInfo)
    {
        // Every column has prefix 'fld' and is uppercase.
        return $"fld{propertyInfo.Name.ToUpper()}";
    }
}

Use the SetColumnNameResolver() method to register the custom implementation:

DommelMapper.SetColumnNameResolver(new CustomColumnNameResolver());

dommel's People

Contributors

alanisaac avatar confcore avatar damienlaw avatar dani-sc avatar danielesky avatar darrenfang avatar dependabot-preview[bot] avatar dependabot[bot] avatar hasancemcerit avatar henkmollema avatar kinglionsoft avatar ldholmgren avatar linjiacheng avatar lucasloss avatar lucaxchaves avatar pauldendulkgeodan avatar renefc3 avatar samuelpampolini avatar sebastianbassen avatar sh1n081 avatar user1336 avatar

Stargazers

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

Watchers

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

dommel's Issues

Sqlite Insert is wrong please use the ;

Hello , i tested your library which seems to become prety good. Your Sqlite code is wrong. pkease fill free to use mibne (MySqliteBuilderร ) instead. You only need to set a semicolon between the insert and select.

I will had my test project, hope it will be hepfull.

public  class MySqliteSqlBuilder : Dommel.DommelMapper.ISqlBuilder
    {
        public string BuildInsert(string tableName, string[] columnNames, string[] paramNames, PropertyInfo keyProperty)
        {
            return string.Format("insert into {0} ({1}) values ({2}); select last_insert_rowid() id",
                tableName,
                string.Join(", ", columnNames),
                string.Join(", ", paramNames));
        }
    }

Regards

No is possible install the package on ".Net Framework=4.5"

Hi Henk Mollema.

I'm trymng install the package into class library project that use ".Net Framework 4.5".

I'm using your project as an alternative to EntityTypeConfiguration for Dapper and would like to be able to map the name of my tables.

This can be considered as a feature or am using the wrong package?

Thank you for your initiative.
Great Job!

Projections

Provide a mechanism to project subsets of tables in queries. For example:

Project<Foo>(x => new { x.Bar, x.Baz, x.Qux });

Dommel ignores DateTimeOffset properties

My table contains datetimeoffset(0) column and respected class has DateTimeOffset property. Current implementation ignores such properties. That is because PropertyResolverBase.PrimitiveTypes property does not contain DateTimeOffset type in its HashSet.
There is a way to resolve this issue by inheriting from DefaultPropertyResolver and override 'PrimitiveTypes' property.

public sealed class CustomPropertyResolver : DommelMapper.DefaultPropertyResolver
        {
            protected override HashSet<Type> PrimitiveTypes => new HashSet<Type>(new[]
                                                                                     {
                                                                                        typeof(object),
                                                                                        typeof(string),
                                                                                        typeof(Guid),
                                                                                        typeof(decimal),
                                                                                        typeof(double),
                                                                                        typeof(float),
                                                                                        typeof(DateTime),
                                                                                        typeof(DateTimeOffset),
                                                                                        typeof(TimeSpan)
                                                                                     });
        }

Then register CustomPropertyResolver somewhere in startup like 'DommelMapper.SetPropertyResolver(new CustomPropertyResolver());'

Would be great if @henkmollema fix it.
BTW, I'm using .NET Core 1.0.1 if it matters

More advanced SQL builder class

Might be nice to have a more advanced SQL builder class for the following operations:

  • Select all entities
  • Select single entity
  • Insert entity
  • Update entity
  • Delete entity
  • Where-clause
  • and/or-clause

Ignore on Property mappings do not works

When i'm trying to make a Crud with this classes and ignore property Friends on Person class mapping, the "ignore" don't works with Dommel.

Error on insert method:
"System.NotSupportedException: The member Friends of type Friend cannot be used as a parameter value".

public class Person{

  public int ID {get;set;}
  public string Name {get;set;}

  public List<Friend> Friends {get;set;}
}

public class Friend{
  public int ID {get;set;}
  public string Name {get;set;} 
}

Thanks in advance

Support Primary Key of type GUID retrieval on Insert

Actually if there is a Primary Key Id of type int,, the insert returns the newly server-generated int value when adding records.
Would be great to also support another type of Primary Key , Guid also server generated.
the fix can be done (in t-sql) with the same scope_identity function, avoiding to cast to int always but taking in account the Guid type

Select with expressions

Add a Select(Expression<Func<TEntity, bool>>) method to the API which accepts an expression which is translated to sql code.

Problem inserting to table with reserved column names

Hello,

I get SQL exceptions when I try to insert into the following table:

CREATE TABLE IF NOT EXISTS `CashLog` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(255) NOT NULL,
  `change` bigint(20) NOT NULL,
  `balance` bigint(20) NOT NULL,
  `use` varchar(255) NOT NULL,
  `time` datetime NOT NULL,
  PRIMARY KEY (`id`),
) ENGINE=InnoDB AUTO_INCREMENT=115 DEFAULT CHARSET=latin1;

The generated SQL Query looks like this:
insert into CashLog (Username, Change, Balance, Use, Time) values ('test', 233, 1219, 'WITHDRAW', '2017-04-30 23:58:55')

The problem is, that the table uses preused names for the column names. So MySQL thinks I am trying to use a MySQL command instead of referencing the column name. If you use apostrophes for inserting, everything works as inteded. The working query looks like this:

insert into CashLog (`username`, `change`, `balance`, `use`, `time`) values ('test', 233, 1219, 'WITHDRAW', '2017-12-31 23:59:59')

It should be easily fixable by modifying the MySqlSqlBuilder return statement to include the ` apostrophe.

EDIT: I fixed the error on my fork and created a pull request. I am pretty new to C# so there may be a cleaner and/or better way :)

Insert error - Cannot insert explicit value for identity column in table 'YouTableName' when IDENTITY_INSERT is set to OFF.

Cannot insert explicit value for identity column in table 'category' when IDENTITY_INSERT is set to OFF.

 private static string BuildInsertQuery(IDbConnection connection, Type type)
        {
            string sql;
            if (!_insertQueryCache.TryGetValue(type, out sql))
            {
                var tableName = Resolvers.Table(type);
                var keyProperty = Resolvers.KeyProperty(type);
                var typeProperties = Resolvers.Properties(type)
                                              .Where(p => p != keyProperty || keyProperty.GetSetMethod() != null)
                                              .Where(p => p.GetSetMethod() != null)
                                              .ToArray();

                var columnNames = typeProperties.Select(Resolvers.Column).ToArray();
                var paramNames = typeProperties.Select(p => "@" + p.Name).ToArray();

                var builder = GetBuilder(connection);

                sql = builder.BuildInsert(tableName, columnNames, paramNames, keyProperty);

                _insertQueryCache[type] = sql;
            }

            return sql;
        }

I think this line of code is a bug:

 .Where(p => p != keyProperty || keyProperty.GetSetMethod() != null)

The old version works fine;

Resolvers.Properties(type).Where(p => p != keyProperty).ToList();  

Add Linq support

Generate SQL queries from Linq expressions.

Perhaps this can be useful: http://relinq.codeplex.com/.


- [x] `Query` - the query object for `TEntity`, implements `IOrderedQueryable`. - [x] `QueryProvider` - implements `System.Linq.IQueryProvider` and serves as a base class for all providers for the `Query` class. - [x] `DommelQueryProvider` - derives from `QueryProvider`, used to generate queries for the `Query` class using a query translator. - [ ] Cache metadata in the `DommelQueryProvider`. - [x] `IQueryTranslator` - defines a contract for query translators. - [ ] `SqlQueryTranslator` - implements `IQueryTranslator` and derives from `System.Linq.Expressions.ExpressionVisitor`, uses `Visit-*` methods to build the sql query for the expression passed in the `Translate(Expression)` method.

SqlQueryTranslator should parse the following LINQ methods:

  • Where
  • Skip
  • Take
  • OrderBy
  • OrderByDescending
  • Count
  • DommelMapperLinq - contains extension methods on the IDbConnection interface. Should also contain methods to pass in custom implementations for IQueryTranslator and IQueryProvider.
  • DommelMapperLinq.Table(IDbConnection) - returns a new instance of the Query<TEntity> class which allows further querying using LINQ.

Lock dictionary caches to prevent duplicate key insert

Currently all the query cache's are stored in dictionaries with

if (!dictionary.hasKey(type)) { //build sql based off of type and store in dictionary }

logic. Problems occur when more than on thread/request hit the same bit of code at the same time. Causes exceptions to occur (typical dictionary key + multi-threading issues).

Passing parameters into `Get()`

image

I'm referring to the file DommelMapper.Get.cs which I have attached as a screenshot.
On line 86, the transaction is passed in as a parameter to Get<TEntity>() if ids.Length == 1.

However, on line 91, the transaction isn't passed in to QueryFirstOrDefault<TEntity>(). I think it's useful to pass the transaction in since it may have an isolation level of RepeatableRows or Serializable.

On the same note, is there a way for us to pass in the CommandTimeout as well?

Add GetAll method

Add the GetAll() method which will return all the objects in the table.

Skip complex properties for entities

Currently, every public property is used when building an insert/update query. Complex properties should be filtered from this. This issue is related to #13.

Fix: create an IPropertyResolver interface with a default implementation. The default implementation should skip complex properties of the type. (i.e.: only int, string, DateTime etc.)

Resolving foreign key properties

Hi,

In your implementation default of interface IForeignKeyPropertyResolver you only get the name of type + Id, but there is any property in the database that not follow this rule.

Maybe you can create a method in DommelEntityMap that set a name of FK Property and in the method ResolveForeignKeyProperty get this name or return this role above.

Thanks.

MultiMap and Inner Joins

The multimap feature writes always "inner joins", but sometimes you will need a "left join".
Perhaps verify if the reference property is a nullable, and in this case uses a left join.

Insert() not works for postgresql

I think that last_insert_rowid is for SQL server, postgresql should use LASTVAL();

Exception Details:
{Npgsql.PostgresException: 42601: syntax error at or near "select"
   at Npgsql.NpgsqlConnector.DoReadMessage(DataRowLoadingMode dataRowLoadingMode, Boolean isPrependedMessage)
   at Npgsql.NpgsqlConnector.ReadMessageWithPrepended(DataRowLoadingMode dataRowLoadingMode)
   at Npgsql.NpgsqlConnector.ReadExpecting[T]()
   at Npgsql.NpgsqlDataReader.NextResultInternal()
   at Npgsql.NpgsqlDataReader.NextResult()
   at Npgsql.NpgsqlCommand.Execute(CommandBehavior behavior)
   at Npgsql.NpgsqlCommand.ExecuteDbDataReaderInternal(CommandBehavior behavior)
   at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior)
   at Dapper.SqlMapper.<QueryImpl>d__1241.MoveNext()
   at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
   at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable1 commandTimeout, Nullable`1 commandType)
   at Dommel.DommelMapper.Insert[TEntity](IDbConnection connection, TEntity entity, IDbTransaction transaction)
   at xxxx.Controllers.Api.BaseController.Create[T](T item) 
....
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionFilterAsync>d__28.MoveNext()}

Multiple RDBMS support

Currently, the queries are SQL Server specific. There should be a mechanism which builds queries for a certain RDBMS based on the current connection.

Create implementations of the ISqlBuilder interface for the following systems:

  • SQL Server
  • MySQL - needs testing
  • SQL Server CE - needs testing
  • SQL Lite - needs testing
  • Postgres - needs testing

v2

  • Split classes into files
  • Support [Table] attribute
  • Support [Column] attribute
  • Support [ForeignKey] attribute - #72
  • Logging of queries
  • Fix joining tables (#29, #35)
  • Automatic multi-mapping single item
  • Add transaction params - #31
  • Paging on Get-queries
  • Paging on Select-queries
  • Automatic multi-mapping collection
  • Multiple primary keys - #54
  • Unit tests
  • Extend select functionality (e.g. OrderBy #56 )
  • More advanced SQL builder class #84
    • Select all entities
    • Select single entity
    • Insert entity
    • Update entity
    • Delete entity
    • Where-clause
    • and/or-clause
  • Projections #85

Joins do not work correctly

When building the join script, the order of the generic type params is used to determine the source and including table. This obviously does not work.

Custom column mapping

One should be able to configure a custom column mapping for an entity property which should be used in every CRUD operation.

Foreign Key Problems

I'm having trouble working with a foreign key.

inside a class, I need to put the name of a property + "Id" so that it is recognized as foreign key.

This is not legal ..

Would not it be better to specify a foreign key at the time of mapping?

For example:

ToTable ("Component");
Map (m => m.Id) .Iskey ();
Map (m => Description);
Map (m => m.Product) .IsForeignKey (); // Suggestion

Invalid Column Map

Hello,
We have the trouble with Dommel.

We use: MySQL 5.6.15 + Dapper 1.50.2 + Dommel 1.6.0 + Dapper.FluentMap.Dommel 1.4.0

Our Model:

public class AppCityList
{
    public int Id { get; set; }
    public string CityName { get; set; }
    public int StateId { get; set; }
    public int CountryId { get; set; }
}

Our Mapping class:

public class AppCityListMap : DommelEntityMap<AppCityList>
{
    public AppCityListMap()
    {
        ToTable("app_city_list");
        Map(p => p.Id).IsKey();
        Map(p => p.CityName).ToColumn("City_Name");
        Map(p => p.StateId).ToColumn("State_Id");
        Map(p => p.CountryId).ToColumn("Country_Id");
    }
}

We have added mapper using next command:

FluentMapper.Initialize(config => { config.AddMap(new AppCityListMap()); });

We try to run query using next command:

private TU GetSingle<TU>(Expression<Func<TU, bool>> predicate)
{
    using (var con = ConnectionFactory.GetReadOnlyConnection())
    {
        var connection = con;
        return Action(con, () =>
        {
            var entities = connection.Select(predicate);
            return entities.FirstOrDefault();
        });
    }
}

public AppCityList GetCityByNameAndStateIdAndCountryId(String cityName, Int32 stateId, Int32 countryId)
{
    return GetSingle<AppCityList>(a => a.CityName == cityName && a.CountryId == countryId && a.StateId == stateId);
}

But our SQL looks like this:
select * from app_city_list where CityName = @p0 and CountryId = @p1 and StateId = @p2

And we have an error:
Unknown column 'CityName' in 'where clause'

This error occurs because only City_Name column exists in our table app_city_list.
Could you help with the problem of improper mapping work?

Caching support

Add a simple, lightweight caching mechanism for retrieving entities.

Conflict in select with inner join

Hi,

In my database there is many table that have columns with same name. When you use select * from the database return an exception.
Perhaps, you use the mapping for especification the name of column in the select clause.

Thank you for all.

Like

Hi,

is there a way to perform a like operation, such as contains?

the query i'm trying to achieve is this:
var result = _repository.GetList(r=> r.ImageName.Contains("yellow");

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.