highwayframework / highway.data Goto Github PK
View Code? Open in Web Editor NEWThe fastest and smoothest way to great architecture
Home Page: http://hwyfwk.com
License: MIT License
The fastest and smoothest way to great architecture
Home Page: http://hwyfwk.com
License: MIT License
If Blog
has many Post
and Post
has required Blog
.
// Arrange
var blog = new Blog();
var post = new Post { Blog = blog };
context.Add(post);
// Act
var fetchedBlog = context.AsQueryable<Blog>().First();
// Assert
fetchedBlog.Posts.Count().Should().Be(1);
For some reason this works :
{
public class GetCountOfAllTables : AdvancedScalar<int>
{
public GetCountOfAllTables()
{
ContextQuery = c => (c as DbContext).Database.SqlQuery<int>("select count(*) from sys.tables").ToList().First();
}
}
But this does not:
{
public class GetCountOfAllTables : AdvancedScalar<int>
{
public GetCountOfAllTables()
{
ContextQuery = c => c.ExecuteSqlQuery<int>("select count(*) from sys.tables").ToList().First();
}
}
I want a context factory that can be configured once via Initialization method, and then used to create contexts without having to pass parameters each time.
Create a performance runner for Highway.Data.Test so that we can help the consumer of the library test more effectively.
This should work correctly.
Making context implement async result pattern by default, and have a synchronous implementation to hide it behind.
A default soft delete solution including the soft deletion entity interface to use.
Out of the box performance runner for queries. Hooked to the pre/post query events most likely.
I tried to write a query to return an IEnumerable and was told it had to be a reference class, but I'm not seeing anywhere that makes that a requirement in our basic query story.
58 public IEnumerable Find(IQuery query) where T : class
59 {
60 return query.Execute(Context);
61 }
Line 58 is the offending line from Repository.cs
Allow simple mappings to be handled via an API like:
Component.For<IMappingConfiguration>()
.Instance(Mappings.FromAssemblyContaing<Foo>())
This should be fluently continuable ala:
Component.For<IMappingConfiguration>()
.Instance(Mappings.FromAssemblyContaing<Foo>()
.AndFromAssemblyContaining<Bar>().
.AndFromAssemblyContaining<Baz>())
Suggested at Dallas C# SIG
Is there a way to access the .AddOrUpdate(x => x.Name, entities.ToArray()) method for entity framework using Highway.Data?
If not, is there a work around? I have a local database and the AddOrUpdate() makes it very easy to keep the database synced.
I see in the documentation that it says to use Query for returning a list of objects, but I was wondering if using Scalar<List> has an down falls vs Query?
I am building a WPF application using the MVVM Light framework. When I try and register the IDataContext interface I am running into this error: The target context 'Highway.Data.DataContext' is not constructible. Add a default constructor or provide an implementation of IDbContextFactory.
I am trying to initialize the DataContext like so:
var context = new DataContext(connectionString, new ElverMappings());
SimpleIoc.Default.Register(() => { return context; });
However if a make a call to the database like the following, I don't get the error.
var repository = new Repository(context);
repository.Context.AsQueryable().Any();
Right after I initialize the IDataContext, I also initialize the IMappingConfiguration, ILog, and IContextConfiguration.
Am I missing something?
Used to encapsulate ContextConfiguration, MappingConfiguration, ConnectionString, and an array of interceptors.
HD Query Dumper
A class that would allow for all query specifications in an application to be dumped to a text file with ease. The challenge is in providing default values for value types that are passed to the query specification. A bit of reflection magic could be used to find all paramaters to the constructor, inspect their type and then provide some default values based on type. It would also need to be robust enough that if a complex type is being passed, to add default values for all properties, and if any dependencies are detected to instantiate them and provide default values for them as well. It would need to hydrate the complete object graph.
The idea is that by providing default values the query can be easily produced. Granted that putting "Hello" or some other nonsense in for strings does not create a query that will actually return data from the system. But it does allow for an easy mechinism to get a query stub generated from the code and into a file or files. Once this is done, it is pretty easy to edit the sql queries to make them actually return data.
If there is a way to setup meta data that would know how to populate value types and complex objects that would be awesome as well. An idea was to use some kind of mocking to proide that. But this didn't feel like a v 1.0 feature.
Example Usage:
Dump all queries to a single file
var queryDumperConfig = new QueryDumperConfiguration();
queryDumperConfig.WriteToSingleFile = true;
queryDumperConfig.FileName = "MyQueries.txt";
queryDumperConfig.Path = "C:\Temp";
var dumper = new QueryDumper(queryDumperConfig);
dumper.Dump();
Dump all queries to seperate files
var queryDumperConfig = new QueryDumperConfiguration();
queryDumperConfig.WriteToSingleFile = false;
queryDumperConfig.Path = "C:\Temp";
var dumper = new QueryDumper(queryDumperConfig);
dumper.Dump();
This will require some functional changes to how those queries are stored.
Scalars will be converted to projection based to allow for SQL output,
using pre/post query
I want to be able to use SQL CE with some of my web applications (GiveCampStarterSite, EventServer, etc) that will not have a ton of data. I will be working on this effort.
Not sure if this will be just an extension method, or possibly a visitor on IQueryable
The following exception
System.InvalidOperationException : Collection was modified; enumeration operation may not execute.
System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
System.Collections.Generic.List`1.Enumerator.MoveNextRare()
System.Collections.Generic.List`1.Enumerator.MoveNext()
System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
System.Linq.Enumerable.d__b1`1.MoveNext()
System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
OGFlex.Areas.Admin.Controllers.CompanyUserFieldsController.Create(CompanyUserFieldModel model) in CompanyUserFieldsController.cs
OGFlex.Tests.Controllers.Admin.CompanyUserFieldsControllerTests
occurs from this code
var allCompanyIds = _accounting.Get<Company>().Select(e => e.Id);
foreach (var companyId in allCompanyIds)
{
var cufv = new CompanyUserFieldValue
{
CompanyId = companyId,
UserField = newUF,
ValueBool = newUF.DefaultBool,
ValueDateTime = newUF.DefaultDateTime,
ValueDecimal = newUF.DefaultDecimal,
ValueString = newUF.DefaultString
};
_accounting.Context.Add(cufv);
}
It should go without saying, but Company has many CompanyUserFieldValue, but this is guaranteed coming from the fact that InMemoryContext keeps one collection, and since we're iterating that list, we cannot add to that list. :(
Unit of Work Implementation around context, possibly just a rename to hide some functionality.
Come up with and implement a name spacing pattern
I want to be able to use SQL CE with some of my web applications (GiveCampStarterSite, EventServer, etc) that will not have a ton of data. I will be working on this effort.
This should be an out of the box interceptor for pre/post save events.
Default implementations of both query loggers and context loggers that can have a verbosity changed in configuration.
This query should support all the needed OData features to be used with most client side tools.
This should add all mappings from all referenced assemblies. It should also be the default for mappings if you're using the new DataContext(connString)
constructor.
We need a example implementation on the wiki for each of the below features. Each Example Implementation should include code that demonstrates the feature, as well as explainations of the steps involve to use it.
I know, I know, documentation is a chore and we all hate it.
But please, please put together full documentation with examples for every last bit of functionality this (excellent) framework provides.
I'm using the Entity Framework flavor and ran into an issue working out what the best way to update an existing object mapped from a business object would be. Nothing but tumbleweed here, an incomplete sample app (no full CRUD, nothing advanced) and a bare API definition (though that's certainly a lot better than nothing!).
Anyway, I'm really impressed so far and it looks like we'll definitely be utilizing this framework in production but the lack of full documentation is driving us nuts.
I think this is done functionally, just needs to be tested better.
yep
The first step to this is a conversation with Ayende
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.