![]() ![]() ![]() Var quer圜ompiler = (Quer圜ompiler)Quer圜ompilerField.GetValue(query.Provider) Public static string ToSql(this IQueryable query) where TEntity : class Private static readonly PropertyInfo DatabaseDependenciesField = typeof(Database).GetTypeInfo().DeclaredProperties.Single(x => x.Name = "Dependencies") Private static readonly FieldInfo DataBaseField = Quer圜(x => x.Name = "_database") Private static readonly FieldInfo QueryModelGeneratorField = Quer圜(x => x.Name = "_queryModelGenerator") Private static readonly FieldInfo Quer圜ompilerField = typeof(EntityQueryProvider).GetTypeInfo().DeclaredFields.First(x => x.Name = "_quer圜ompiler") ![]() Private static readonly TypeInfo Quer圜ompilerTypeInfo = typeof(Quer圜ompiler).GetTypeInfo() Here is the crazy reflection code (extension method): public static class IQueryableExtensions You can implement some custom reflection code similar to the older approach to perform the same basic concept. Using an SQL Profiler like MiniProfiler to monitor the executing query. Logging the executing query using your logger of choice or the built-in Logger in. There are 3 approaches for logging SQL statements from IQueryable: Since EF 7 is renamed to Entity Framework Core I will summarize you the options for EF Core. For EF Core 3.0 and 3.1 see the Kiesewetter's answer We need more abstractionĪt this point our database abstraction is ready to use.This answer is for EF Core 2.1. With this markdown extractor implementation it is also possible to extract YAML data from the top of a markdown file. Import IDatabase from './interfaces/IDatabase' export class Database implements IDatabase The file driver uses an extractor implementation to generate an object from the contents of a Markdown file. In this case we’re using a file driver which pulls content from a resources directory. What we’re going to build is a database abstraction layer which uses a driver to access data from wherever the driver decides. Today I started rewriting the static site generator which is powering this blog (which I initially hacked together not caring too much about the quality of the code) with TypeScript, beginning with implementing a (file based) database. I’m currently in the process of rewriting some of my projects using the TDD approach and after I did some more research on TypeScript I was quite tempted to also use TypeScript in favor of vanilla JavaScript. I’m not quite sure yet if I like Angular 2 or not but TypeScript definitely caught my attention. Ionic 2 is built on top of Angular 2 which in turn is built with TypeScript. But I found the technologies used by Ionic 2 to be interesting. Long story short – I quickly realized it would be too much work to build the app I had in mind. I decided this was the perfect opportunity to give Ionic a try. Two weeks ago, I had this idea for an app. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |