Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am fairly new to the Repository pattern (just got back from stone age, hi everyone :-). My dilemma is that I am need to develop a way my Windows Store app work with SQLite (SQLite-Net) today, and in a near future work off WCF services (or some non-direct database access). Basically I want to switch provider for my data access layer easily.
The best site I came across with example is this blog (http://blog.longle.net/2013/05/11/genericizing-the-unit-of-work-pattern-repository-pattern-with-entity-framework-in-mvc/)
But like any other place it still have heavy dose of Entity framework which I don't think applicable to my situation.
Can someone point out possible solutions or references that I can further work on ?
Thanks
Welcome back! I hope the food was good. :-)
You can implement the Repository pattern by writing your own data access layer (DAL) as an interface, and then just writing adapter classes to SQLite and WCF respectively, that both implement that interface. Your interface(s) would define query methods and update methods. For example, you can write the following:
public interface IWidgetRepository
{
// Query methods
Widget GetById(string id);
IEnumerable<Widget> GetFeaturedWidgets();
IEnumerable<Widget> GetRecommendedWidgetsForUser(string userId);
// Update methods
void RenameWidget(string id, string newName);
void UpdateWidgetPrice(string id, decimal newPrice);
}
See also this answer on a similar question; it goes into some more detail. You're in the same situation as in that question, even though it looks different on the surface because you're coming from a different starting point. But the solution is the same once you see how the underlying pattern works.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Improve this question
I am doing a project in MVC 3 with C# and would like to put test cases to simulate user actions in Views, and compare if the data was saved correctly in the database. But searched and did not find any material or good example.
Any suggestions how to do?
This is called "end-to-end" testing, or "integration" testing, and there are many frameworks and solutions out there for this.
One that I have used in the past is Selenium: http://docs.seleniumhq.org/
But there are many others: http://en.wikipedia.org/wiki/List_of_GUI_testing_tools
They are called "end-to-end" because they automate the UI as if it is the user performing the actions, and then they run steps to validate the results of said actions; in this way, they test the entire application at once rather than each independent component individually (as is the case with Unit Tests).
An important aspect of writing tests is that views and UI are difficult to test / simulate. MVC and MVVM get around this by letting you test your Model and Controller or your Model and ViewModel.
There are tools that help you to test the views for doing UI testing like Watin, Selenium etc.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
How do I use ASP.NET Identity into empty web projects?
I didn't do the google-ing for you, I just happened to be doing some research myself and came across the following resources.
Two good blog posts on odetocode.com here and here.
On the subject of empty web projects (taken from comments from above links):
People who want to start from scratch are usually looking to do something like create a .Domain or .Core assembly with their own definition of a user that can plug into the Identity framework. Unfortunately, this means you either take a dependency on the Entity Framework in a domain assembly (to inherit from IdentityUser) or re implement IUser and IUserStore from scratch. It's also much easier to use classes like ApplicationUser for a new application but a bit difficult to manage with an existing schema until you've figured out all the pieces (like how to do mapping with EF).
There is also the Identity Database template which has all the scripts, UDTs etc. used in ASP.NET Identity, available here.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am going to develop a project where i would like to use Entity Framework 5 with Code First Approach. I want to use multiple DbContext file. So can anyone please give an example with with a sample project to demonstrate multiple DbContext file. I will be highly grateful.
Thanks .
I don't know if this is a good idea, because there are many side effects. Have a look here:
Entity Framework: One Database, Multiple DbContexts. Is this a bad idea?
But in fact it should be working when you look at the latest comment on this thread. Just define the ConnectionString in the context and set it to the same in every context class.
If you need more informations please provide us with more informations what you are trying to achieve and what's your requirements.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm writing an OOP project, need to map the object oriented domain into the database, storing objects into the database, I worked with hibernate of java before, now I look for the same thing in C#.
I heard about NDatabase but I dont use it, any one here know and work with it?
For my professional work, I really like EntityFramework. it's powerful and pretty straightforward to use. Here is the guideline to work with (provided by Microsoft): http://msdn.microsoft.com/en-us/data/ef.aspx
i would recommend EntityFramework.
Hope i could help.
Try NHibernate - .net port of hibernate.
Also, take a look at Entity Framework
I think, choosing an ORM solution depends on the database you gonna use. If you're sure it's Sql Server, definitely go for Entity Framewrok since all the advanced features (like code-first) are supported there out of the box. If you go for Oracle, I would suggest NHibernate especially since you already know Hibernate
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Microsoft provides a WCF Data Services Client Library to implement OData clients in C#. This library works on the principle of creating a typed reference to the OData service.
What would be a good approach to implement an OData client in C# without having to previously generate a typed service interface? In other words, what would be a good way to implement an OData client in C# that could work with several different OData services, given the base URL and entity names as strings?
Such client would use dynamic C# objects or dictionaries to represent the entities, instead of typed entity objects.
Which existing libraries or projects could be leveraged to implement this?
One application of this technique would be to develop a generic functional test suite helper library that could be used to implement tests of OData services.
The pointer to odata-sdk above is definitely a good start. For one the OData Explorer which is also listed on that site is almost exactly what you're looking for. It's a general OData service "browser".
Another approach (maybe even better) would be to use Microsoft.Data.OData.dll. It's part of the latest CTP of WCF Data Services (http://blogs.msdn.com/b/astoriateam/archive/2011/10/13/announcing-wcf-data-services-oct-2011-ctp-for-net-4-and-silverlight-4.aspx).
It's a low-level reader and writer for OData. It doesn't solve the URL processing, but reading and writing the payloads works great.
There's a sample of a usage here: http://blogs.msdn.com/b/astoriateam/archive/2011/10/14/introducing-the-odata-library.aspx
you need nothing more than a URL/ String Parser for this , for more drill down approach you may also like to look at some options here:
http://www.odata.org/developers/odata-sdk