This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void TypedViewPocoTest1() | |
{ | |
using(var adapter = new DataAccessAdapter()) | |
{ | |
var metaData = new LinqMetaData(adapter); | |
var q = (from i in metaData.InvoicesPocoLinq | |
where i.Country == "USA" | |
select i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// these lambda's are used in e.g. projections in typed queries to materialize object arrays into typed objects. | |
// running this 100000 times at runtime takes 20551ms | |
System.Linq.Expressions.Expression<Func<OrderPocoQsRow>> l = () => new NW26.Adapter.TypedViewClasses.OrderPocoQsRow() | |
{ | |
CustomerId = OrderPocoQsFields.CustomerId.ToValue<System.String>(), | |
EmployeeId = OrderPocoQsFields.EmployeeId.ToValue<Nullable<System.Int32>>(), | |
Freight = OrderPocoQsFields.Freight.ToValue<Nullable<System.Decimal>>(), | |
OrderDate = OrderPocoQsFields.OrderDate.ToValue<Nullable<System.DateTime>>(), | |
OrderId = OrderPocoQsFields.OrderId.ToValue<System.Int32>(), | |
RequiredDate = OrderPocoQsFields.RequiredDate.ToValue<Nullable<System.DateTime>>(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated linq queries: | |
/// <summary>Gets the query to fetch the typed list OneToManyPocoLinq</summary> | |
public IQueryable<Northwind.Adapter.TypedListClasses.OneToManyPocoLinqRow> GetOneToManyPocoLinqTypedList() | |
{ | |
var current0 = this.Customer; | |
var current1 = from c in current0 | |
join o in this.Order on c.CustomerId equals o.CustomerId | |
join od in this.OrderDetails on o.OrderId equals od.OrderId | |
select new {o, c, od }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object newValueInType = newValue; | |
string newValueAsString = newValue as string; | |
if(type == typeof(DateTimeOffset)) | |
{ | |
newValueInType = DateTimeOffset.Parse(newValueAsString); | |
} | |
if(type == typeof(Guid)) | |
{ | |
newValueInType = Guid.Parse(newValueAsString); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in the generated massive file for fluent mappings. | |
public partial class FluentModel : OpenAccessContext, IFluentModelUnitOfWork | |
{ | |
private static string connectionStringName = @"AdventureWorksConnection"; | |
private static BackendConfiguration backend = GetBackendConfiguration(); | |
// The line below is generated by the Telerik 'wizard' (which should actually be called 'dumbass') and causes the code to recreate the mapping model | |
// every time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Cleans up the data reader (closes it if necessary and disposes it) | |
/// </summary> | |
/// <param name="reader">The reader.</param> | |
/// <param name="queryExecuted">The query executed.</param> | |
/// <param name="disposeReader">if set to <c>true</c> [dispose reader].</param> | |
internal static void CleanupDataReader(IDataReader reader, IQuery queryExecuted, bool disposeReader) | |
{ | |
if(reader != null) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string ConnectionString = @"data source=zeusVM\SQLSERVER2005;initial catalog=AdventureWorks;integrated security=SSPI;persist security info=False;packet size=4096"; | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Starting"); | |
FetchEntityCollectionAsync(); | |
Console.WriteLine("Fetch called. Press enter to quit"); | |
Console.ReadLine(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected object GetValue(int fieldIndex, bool returnDefaultIfNull) | |
{ | |
if(_fields == null) | |
{ | |
return null; | |
} | |
if(_fields.State == EntityState.Deleted) | |
{ | |
throw new ORMEntityIsDeletedException("This entity is deleted from the database and can't be used in logic.", this); |
NewerOlder