Skip to content

Commit

Permalink
fix binding method nasty bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jesuslpm committed Dec 31, 2013
1 parent 40bcc8b commit 5400e0d
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 14 deletions.
80 changes: 80 additions & 0 deletions Samples/DataLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,21 @@ public CategoryRepository(DataService DataService) : base(DataService)
set { base.DataService = value; }
}

public Category Get(string projectionName, System.Int32 categoryId)
{
return ((IRepository<Category>)this).Get(projectionName, categoryId, FetchMode.UseIdentityMap);
}

public Category Get(string projectionName, System.Int32 categoryId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Category>)this).Get(projectionName, categoryId, fetchMode);
}

public Category Get(Projection projection, System.Int32 categoryId)
{
return ((IRepository<Category>)this).Get(projection, categoryId, FetchMode.UseIdentityMap);
}

public Category Get(Projection projection, System.Int32 categoryId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Category>)this).Get(projection, categoryId, fetchMode);
Expand Down Expand Up @@ -147,11 +157,21 @@ public CustomerRepository(DataService DataService) : base(DataService)
set { base.DataService = value; }
}

public Customer Get(string projectionName, System.String customerId)
{
return ((IRepository<Customer>)this).Get(projectionName, customerId, FetchMode.UseIdentityMap);
}

public Customer Get(string projectionName, System.String customerId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Customer>)this).Get(projectionName, customerId, fetchMode);
}

public Customer Get(Projection projection, System.String customerId)
{
return ((IRepository<Customer>)this).Get(projection, customerId, FetchMode.UseIdentityMap);
}

public Customer Get(Projection projection, System.String customerId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Customer>)this).Get(projection, customerId, fetchMode);
Expand Down Expand Up @@ -281,11 +301,21 @@ public EmployeeRepository(DataService DataService) : base(DataService)
set { base.DataService = value; }
}

public Employee Get(string projectionName, System.Int32 employeeId)
{
return ((IRepository<Employee>)this).Get(projectionName, employeeId, FetchMode.UseIdentityMap);
}

public Employee Get(string projectionName, System.Int32 employeeId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Employee>)this).Get(projectionName, employeeId, fetchMode);
}

public Employee Get(Projection projection, System.Int32 employeeId)
{
return ((IRepository<Employee>)this).Get(projection, employeeId, FetchMode.UseIdentityMap);
}

public Employee Get(Projection projection, System.Int32 employeeId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Employee>)this).Get(projection, employeeId, fetchMode);
Expand Down Expand Up @@ -386,11 +416,21 @@ public OrderDetailRepository(DataService DataService) : base(DataService)
set { base.DataService = value; }
}

public OrderDetail Get(string projectionName, System.Int32 orderDetailId)
{
return ((IRepository<OrderDetail>)this).Get(projectionName, orderDetailId, FetchMode.UseIdentityMap);
}

public OrderDetail Get(string projectionName, System.Int32 orderDetailId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<OrderDetail>)this).Get(projectionName, orderDetailId, fetchMode);
}

public OrderDetail Get(Projection projection, System.Int32 orderDetailId)
{
return ((IRepository<OrderDetail>)this).Get(projection, orderDetailId, FetchMode.UseIdentityMap);
}

public OrderDetail Get(Projection projection, System.Int32 orderDetailId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<OrderDetail>)this).Get(projection, orderDetailId, fetchMode);
Expand Down Expand Up @@ -526,11 +566,21 @@ public OrderRepository(DataService DataService) : base(DataService)
set { base.DataService = value; }
}

public Order Get(string projectionName, System.Int32 orderId)
{
return ((IRepository<Order>)this).Get(projectionName, orderId, FetchMode.UseIdentityMap);
}

public Order Get(string projectionName, System.Int32 orderId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Order>)this).Get(projectionName, orderId, fetchMode);
}

public Order Get(Projection projection, System.Int32 orderId)
{
return ((IRepository<Order>)this).Get(projection, orderId, FetchMode.UseIdentityMap);
}

public Order Get(Projection projection, System.Int32 orderId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Order>)this).Get(projection, orderId, fetchMode);
Expand Down Expand Up @@ -645,11 +695,21 @@ public ProductRepository(DataService DataService) : base(DataService)
set { base.DataService = value; }
}

public Product Get(string projectionName, System.Int32 productId)
{
return ((IRepository<Product>)this).Get(projectionName, productId, FetchMode.UseIdentityMap);
}

public Product Get(string projectionName, System.Int32 productId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Product>)this).Get(projectionName, productId, fetchMode);
}

public Product Get(Projection projection, System.Int32 productId)
{
return ((IRepository<Product>)this).Get(projection, productId, FetchMode.UseIdentityMap);
}

public Product Get(Projection projection, System.Int32 productId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Product>)this).Get(projection, productId, fetchMode);
Expand Down Expand Up @@ -731,11 +791,21 @@ public ShipperRepository(DataService DataService) : base(DataService)
set { base.DataService = value; }
}

public Shipper Get(string projectionName, System.Int32 shipperId)
{
return ((IRepository<Shipper>)this).Get(projectionName, shipperId, FetchMode.UseIdentityMap);
}

public Shipper Get(string projectionName, System.Int32 shipperId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Shipper>)this).Get(projectionName, shipperId, fetchMode);
}

public Shipper Get(Projection projection, System.Int32 shipperId)
{
return ((IRepository<Shipper>)this).Get(projection, shipperId, FetchMode.UseIdentityMap);
}

public Shipper Get(Projection projection, System.Int32 shipperId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Shipper>)this).Get(projection, shipperId, fetchMode);
Expand Down Expand Up @@ -833,11 +903,21 @@ public SupplierRepository(DataService DataService) : base(DataService)
set { base.DataService = value; }
}

public Supplier Get(string projectionName, System.Int32 supplierId)
{
return ((IRepository<Supplier>)this).Get(projectionName, supplierId, FetchMode.UseIdentityMap);
}

public Supplier Get(string projectionName, System.Int32 supplierId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Supplier>)this).Get(projectionName, supplierId, fetchMode);
}

public Supplier Get(Projection projection, System.Int32 supplierId)
{
return ((IRepository<Supplier>)this).Get(projection, supplierId, FetchMode.UseIdentityMap);
}

public Supplier Get(Projection projection, System.Int32 supplierId, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<Supplier>)this).Get(projection, supplierId, fetchMode);
Expand Down
10 changes: 10 additions & 0 deletions Samples/EntityLite.ttinclude/EntityGeneration.ttinclude
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,21 @@ void RenderEntityRepositoryClass(DataLayerGeneration generation, EntitySetting e
if (primaryKeyField != null)
{
#>
public <#= entity.EntityName #> Get(string projectionName, <#=primaryKeyField.PropertyType.ToString() #> <#=primaryKeyField.PropertyName.ToParameterName() #>)
{
return ((IRepository<<#= entity.EntityName #>>)this).Get(projectionName, <#=primaryKeyField.PropertyName.ToParameterName() #>, FetchMode.UseIdentityMap);
}

public <#= entity.EntityName #> Get(string projectionName, <#=primaryKeyField.PropertyType.ToString() #> <#=primaryKeyField.PropertyName.ToParameterName() #>, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<<#= entity.EntityName #>>)this).Get(projectionName, <#=primaryKeyField.PropertyName.ToParameterName() #>, fetchMode);
}

public <#= entity.EntityName #> Get(Projection projection, <#=primaryKeyField.PropertyType.ToString() #> <#=primaryKeyField.PropertyName.ToParameterName() #>)
{
return ((IRepository<<#= entity.EntityName #>>)this).Get(projection, <#=primaryKeyField.PropertyName.ToParameterName() #>, FetchMode.UseIdentityMap);
}

public <#= entity.EntityName #> Get(Projection projection, <#=primaryKeyField.PropertyType.ToString() #> <#=primaryKeyField.PropertyName.ToParameterName() #>, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<<#= entity.EntityName #>>)this).Get(projection, <#=primaryKeyField.PropertyName.ToParameterName() #>, fetchMode);
Expand Down
Binary file modified Samples/Northwind.mdf
Binary file not shown.
Binary file modified Samples/Northwind_log.ldf
Binary file not shown.
6 changes: 4 additions & 2 deletions Samples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ static void Main(string[] args)
//TestOracleSeq();
//ToPascalTests();
//RaiseProductPrices();
//InsertUpdateDeleteProduct();
InsertUpdateDeleteProduct();
//ShowPagedProducts();
//ShowSomeProducts();
//ShowQuesoCabralesOrders();
//ShowLondonAndewFullerSubtree();
//HandCraftedSql();
//ShowProductSales();
RaiseProductPrices2();
//RaiseProductPrices2();
}

private static void RaiseProductPrices2()
Expand Down Expand Up @@ -371,6 +371,8 @@ static void InsertUpdateDeleteProduct()

Console.WriteLine("CategoryName:" + p.CategoryName);

p = ds.ProductRepository.Get(Projection.BaseTable, p.ProductId);

ds.ProductRepository.Delete(p.ProductId);

ds.Commit();
Expand Down
4 changes: 2 additions & 2 deletions inercya.EntityLite/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.9.0")]
[assembly: AssemblyFileVersion("1.0.9.0")]
[assembly: AssemblyVersion("1.0.10.0")]
[assembly: AssemblyFileVersion("1.0.10.0")]
2 changes: 2 additions & 0 deletions inercya.EntityLite/Extensions/QueryLiteExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,8 @@ public static object Get(this IQueryLite query, int id)
/// <returns></returns>
public static IQueryLite<TEntity> Fields<TEntity>(this IQueryLite<TEntity> query, FieldsOption options, params string[] fields)
{
if (fields == null || fields.Length == 0) return query;

var metadata = typeof(TEntity).GetEntityMetadata();

var invalidField = fields.FirstOrDefault(x => {
Expand Down
8 changes: 4 additions & 4 deletions inercya.EntityLite/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public interface IRepository
void Delete(object entity);
Type EntityType { get; }

object Get(Projection projection, object entityId, FetchMode fetchMode = FetchMode.UseIdentityMap);
object Get(string projectionName, object entityId, FetchMode fetchMode = FetchMode.UseIdentityMap);
object Get(Projection projection, object entityId, FetchMode fetchMode);
object Get(string projectionName, object entityId, FetchMode fetchMode);
object Get(Projection projection, object entityId, string[] fields);
object Get(string projectionName, object entityId, string[] fields);

Expand All @@ -36,8 +36,8 @@ public interface IRepository<TEntity> : IRepository
new IQueryLite<TEntity> Query(Projection projection);
new IQueryLite<TEntity> Query(string projectionName);

new TEntity Get(Projection projection, object entityId, FetchMode fetchMode = FetchMode.UseIdentityMap);
new TEntity Get(string projectionName, object entityId, FetchMode fetchMode = FetchMode.UseIdentityMap);
new TEntity Get(Projection projection, object entityId, FetchMode fetchMode);
new TEntity Get(string projectionName, object entityId, FetchMode fetchMode);
new TEntity Get(Projection projection, object entityId, string[] fields);
new TEntity Get(string projectionName, object entityId, string[] fields);
}
Expand Down
Binary file added nuget/Core/EntityLite.Core.1.0.10-Beta.nupkg
Binary file not shown.
2 changes: 1 addition & 1 deletion nuget/Core/EntityLite.Core.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>EntityLite.Core</id>
<version>1.0.9-Beta</version>
<version>1.0.10-Beta</version>
<title>i-nercya EntityLite Core</title>
<authors>Jesús López (i-nercya intelligent software)</authors>
<owners></owners>
Expand Down
2 changes: 1 addition & 1 deletion nuget/Core/Publish.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
%~dp0..\NuGet.exe Update -self
%~dp0..\NuGet.exe Push EntityLite.Core.1.0.9-Beta.nupkg
%~dp0..\NuGet.exe Push EntityLite.Core.1.0.10-Beta.nupkg
pause
Binary file added nuget/Generators/EntityLite.1.0.10-Beta.nupkg
Binary file not shown.
4 changes: 2 additions & 2 deletions nuget/Generators/EntityLite.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>EntityLite</id>
<version>1.0.9-Beta</version>
<version>1.0.10-Beta</version>
<title>i-nercya EntityLite</title>
<authors>Jesús López (i-nercya intelligent software)</authors>
<owners></owners>
Expand All @@ -22,7 +22,7 @@
<copyright>Copyright 2013</copyright>
<dependencies>
<group targetFramework="net35-client">
<dependency id="EntityLite.Core" version="[1.0.9-Beta]" />
<dependency id="EntityLite.Core" version="[1.0.10-Beta]" />
</group>
</dependencies>
<references></references>
Expand Down
2 changes: 1 addition & 1 deletion nuget/Generators/Publish.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
%~dp0..\NuGet.exe Update -self
%~dp0..\NuGet.exe Push EntityLite.1.0.9-Beta.nupkg
%~dp0..\NuGet.exe Push EntityLite.1.0.10-Beta.nupkg
pause
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,21 @@ void RenderEntityRepositoryClass(DataLayerGeneration generation, EntitySetting e
if (primaryKeyField != null)
{
#>
public <#= entity.EntityName #> Get(string projectionName, <#=primaryKeyField.PropertyType.ToString() #> <#=primaryKeyField.PropertyName.ToParameterName() #>)
{
return ((IRepository<<#= entity.EntityName #>>)this).Get(projectionName, <#=primaryKeyField.PropertyName.ToParameterName() #>, FetchMode.UseIdentityMap);
}

public <#= entity.EntityName #> Get(string projectionName, <#=primaryKeyField.PropertyType.ToString() #> <#=primaryKeyField.PropertyName.ToParameterName() #>, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<<#= entity.EntityName #>>)this).Get(projectionName, <#=primaryKeyField.PropertyName.ToParameterName() #>, fetchMode);
}

public <#= entity.EntityName #> Get(Projection projection, <#=primaryKeyField.PropertyType.ToString() #> <#=primaryKeyField.PropertyName.ToParameterName() #>)
{
return ((IRepository<<#= entity.EntityName #>>)this).Get(projection, <#=primaryKeyField.PropertyName.ToParameterName() #>, FetchMode.UseIdentityMap);
}

public <#= entity.EntityName #> Get(Projection projection, <#=primaryKeyField.PropertyType.ToString() #> <#=primaryKeyField.PropertyName.ToParameterName() #>, FetchMode fetchMode = FetchMode.UseIdentityMap)
{
return ((IRepository<<#= entity.EntityName #>>)this).Get(projection, <#=primaryKeyField.PropertyName.ToParameterName() #>, fetchMode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<#@ assembly name="Microsoft.CSharp" #>
<#@ assembly name="System.Data" #>
<#@ assembly name="System.Xml" #>
<#@ assembly name="$(SolutionDir)packages\EntityLite.Core.1.0.9-Beta\lib\net35-client\inercya.EntityLite.dll" #>
<#@ assembly name="$(SolutionDir)packages\EntityLite.Core.1.0.10-Beta\lib\net35-client\inercya.EntityLite.dll" #>
<#@ import namespace="System" #>
<#@ import namespace="System.Reflection" #>
<#@ import namespace="System.Data" #>
Expand Down

0 comments on commit 5400e0d

Please sign in to comment.