I am trying to implement the DevExpress Grid in an asynchronous way, which means that I would like it to load a set amount of data and be able to edit the loaded data.
DevExpress is providing a EntityInstantFeedbackSource class which can be used to load data asynchronously. The problem is that this class does not provide the ability to edit the data and it also seems to produce problems when used with DevForce as entity provider (link to the Problem)
There seems to be an interface (IAsyncListServer) on DevExpress side, but it looks like if they don't recommend to implement it just yet as it may change in the future and it also seems quite complex for what I try to achieve and I already tried to implement the interface without any success. I did the following:
Created a class which implemented every method of IAsyncListServer and used it as source for the grid. The problem is that none of the methods seem to get called from the grid.
Maybe someone has an idea for a workaround or something to achieve this kind of functionality with the DXGrid.
If this is not possible are there any other Grid options with a better support for such a requirement? I already tried Xceed which seems to be nice but my problem with them is that they do not provide a full suite of controlls.
I would suggest that you try WCF Data Services together with the WCFInstantFeedbackSource. This is a good tandem for implementing asunchronous views in multi-tier application.
Though, WCFInstantFeedbackSource is also read only.
Related
I've found a good 2 factor authentication library on github that I like and I'm trying to integrate it into my Asp.Net Core project, but I'm having trouble finding what I need to do to achieve that.
I've got a custom UserStore implementing IUserStore and IUserTwoFactorStore (As well as a bunch of other interfaces) but those only show how to determine if the user actually has 2-FA enabled or not and set it, but not how to actually add and retrieve a custom provider.
I've got /can figure out all of the code I need to get the 2-FA working, it's just hooking it up that I'm stuck on.
I hope that I don't need to create a custom UserManager implementation, as that could potentially be a lot more work (Although I suspect it's the case - the following methods look promising GetValidTwoFactorProvidersAsync(), GenerateTwoFactorTokenAsync(), VerifyTwoFactorTokenAsync()).
I ended up creating a custom version of the UserManager class, and only overrode the 3 methods I described above.
It seems to do the job and was pretty quick (I was originally worried that I'd have to implement/override all the methods, but realized once I started that that wasn't the case).
I would like to retrieve Data from a remote api (via HTTP.get) and pass it to the client. Currently I manually poll the data and implemented some template helpers, that pass the data to the views.
In case of a jquery datatable I use the jquery-datatables package and that needs a published collection.
Has anyone a hint for me how to implement this?
Just for others who might want to know how to solve this:
You'll find an example here: https://github.com/avital/publish-time/blob/master/publish-time.js
The code is shown in this 20 min video: https://www.youtube.com/watch?v=onCkNRE2q0c
With that you'll be able to quickly implement custom publish/subscribe without using MongoDB.
#richsilv: Thanks again for pointing me to the right stuff.
In the recent spirit of isolating stuff and plugging it in via NuGet, does anyone have an idea about how you'd limit a dependency resolver to just one area in MVC3? It's easy enough to keep views and controllers limited to an area, but unless I'm not seeing an obvious hook, it looks like setting an IDependencyResolver is something that unavoidably has global scope. I'd like to limit it to just one area.
Any suggestions?
IDependencyResolver is global by design. If you want to vary behavior by area, you should look at the various *Activator types and interfaces that can make decisions based on context objects.
What specifically are you trying to do?
I would suggest using the Common Service Locator for this. Basically each area could setup up the CSL for their specific container.
You will probably need to create an adapter between the dependency resolver or forgo it altogether and strictly use the CSL.
In general I am not a proponent of using the CSL in a line of business app. It's intent is to make it easier for open source components that use DI (like MassTransit) easier to integrate into line of business apps. This might be an exception however.
Also, look into the mvccontrib portable areas. It's designed for this type of thing.
What you're trying to do sounds like a bad idea. The point of dependency injection is so you can isolate specific dependencies and not have your code care where they come from.
If you're trying to restrict some objects or classes to a certain MVC area, configure your dependency injector to call the proper ones at the right time.
Some more details about what you're trying to do will help generate better answers.
I've inherited a asp.net project and I'm finding that the code behind pages contain a lot of business logic.
I've decided that in most cases it's better to leave the working code in place than try and do a massive refactoring. However there are pages that perform functionality that could be re-used in command line utilities for batch processing. I'd like to focus my energies on these pages, refactoring out the business logic and referencing that in other utilities.
I am currently looking to refactor this particular page which has 6200 lines of code in the code behind. What I'm finding is it's very tedious work trying to locate the dependencies between the code behind and the page specific objects.
I'm wondering if anybody knows of a tool, a VS feature, or a method that would allow me to systematically locate and attack these dependencies? Something that will allow me to identify any area of the code that references ViewState, a textbox, panel, drop downlist, etc..., so I can move these references to method parameters and ultimately move this functionality out of the page class.
I would begin by examining any method that doesn't follow the Single Responsibility Principle and break them down so that they do. Once that's done you should have a handle on what the code does and you should be able to group the code more easily and move it into dedicated classes for those groups creating the necessary objects to use as you go. I find ReSharper is a very useful tool to help do all this. Ultimately you will always need to have a solid grasp of the fundamentals within the code before you can successfully refactor.
We've all been there at some point and you have my deepest sympathy but your willingness to attempt it at all means you're already heading in the right direction. Good Luck!
Wow first of all sorry to here that. Anyone who would put 6000 lines of code in code behind deserve to be smacked :)
Now I have done this kind of refactoring before. I would approach this in few steps:
(1) Create Logical Regions #Region and #EndRegion
Like - Save Methods , Load Methods or
(2) See if you can create physical business objects based on these regions in your business
layer
(3) Once you are done just refer all your code to appropriate class.
I understand you want some tool to make this all go away but I am afraid by doing this you will dig the hole dipper. Understanding the code and moving it method by method will give you better understanding.
One way I can immediately think is Compile then into Assemblies and Analyze the assembly using NDepend
http://www.ndepend.com/Features.aspx#DependencyCycle
(source: ndepend.com)
I was watching a tutorial on Rails and was very impressed that you could so easily create an editing system for a class just by defining it.
Can this be done in ASP.NET?
I know there are ORMs out there, but do they come with an editing system?
To explain what I mean by an editing system, consider a class for defining people
class Person
{
string First_Name;
string Last_Name
}
And then perhaps with one bold stroke something like this:
CreateEditAbleClass(Person)
You would get the functionality below in a browser:
http://www.yart.com.au/images/orm_editor.jpg
And this functionality would extend to all the UML definitions – inheritance, association, aggregation etc. In addition, there would be a simple way of adding customisable validation and so forth.
I currently use DataGrids and a lot of manual coding to achieve these results.
You can do it with reflection. Using reflection, you can enumerate over the members of a class, and therefore create a form to edit the members.
Creating the code for rendering the web form based on the members of the class is a bit more code then I'm willing to type out here, but if you look into reflection you should be able to come up with your own solution in a couple hours.
Sure. This is off the top of my head, but I believe you could connect your class to an ObjectDataSource component which would in turn connect to a DetailsView control. So it's a hair more work, but it would be pretty trivial to have a method that created the needed items on the fly and bound them together.
This is called "Scaffolding".
It really depends on what you are using for your data layer or ORM. Entityspaces, for example, comes with a scaffolding generator.
Absolutely! Scaffolding in Ruby is known as Dynamic Data in ASP.NET. Scott Hanselman speaks to Dynamic Data here.
There's a screen cast from Scott Hunter that shows it off here. It's of note that it's pretty new (still in beta).
You can for simple sites/purposes but it quickly breaks down when you want to do something more complex. Like what happens if you don't want certain fields to be visible, what happens if you have a relationship to a subset of a certain class etc.
Having been down this path before I'm guessing you came at the issue by realizing that:
You spend alot of time creating similar forms/lists etc for similar entities.
You want to minimize this time and are considering if your forms can be automatically generated.
Basically, if you want it to be done automatically then you'll end up creating an overcomplicated system that does half of what you want and actually takes longer to implement.
If however, you want to drastically cut the amount of time doing and maintaining writing repetitive gui code then then I suggest using a declarative style form builder and table builder (like the form builder in ROR).
This lets you quickly create forms/tables without repeating yourself any more than necessary and also gives you the flexibility that you need for complex scenarios.