I've been tasked with a project that requires me to convert a quote for a set of products that is displayed online into a particular file format for import into a third party application. All of the information I need is stored in a database that I can easily access.
Unfortunately, I absolutely have to offer this as a web interface and they want it to be a natural extension of their current ASP.NET product.
Even more unfortunate is that I've had no prior experience in ASP.NET and, as a result, I can't seem to phrase my question in a way that gets the desire result in search engines. I guess I'm behind on the proper terminology.
What I'd like to do is to take the data in the database and read it into objects that I've created in C# that hold their particular necessary attributes. For instance:
The QUOTE class contains a list of ITEM attributes.
The ITEM class contains a list of MODIFICATIONs.
I could then just loop over all the line items and output the necessary information to perform the task.
I'm familiar with Ruby on Rails and how I can set up objects, work on them, and then reference them in the view, but I'm completely lost in ASP.NET.
So, the short version is this:
What am I trying to do in terms of ASP.NET terminology so that I can research how to do it?
Is it even possible?
You will need two things that will help you out tremendously, for this project and for the next ones:
Learn a bit of LINQ, specifically Linq to SQL. The best book is "Linq in Action" by Manning. LINQ will open up a whole new horizon on data access and will make your like easier.
Follow the ASP .NET MVC tutorial at NerdDinner.com. It will get you familiarized with MVC in a few hours.
You need less than a week to get you up to speed, and then the project will suddenly look a lot more approachable.
If you are familiar with Rails, then you will want to look at ASP.Net MVC
You need an object-relational mapper, or ORM. The most popular one is NHibernate, and some folks have created a framework called ActiveRecord that sits atop it and acts sort of like the activerecord you're probably familiar with in Rails. Start your Googling there, with NHibernate.
they want it to be a natural
extension of their current ASP.NET
product.
Depending what platform they are in right now, if it's asp.net webform, then I suggest you look into GridView control since it's very powerful to display the grid Data.
If you go for Asp.Net mvc which is closer to Rails, then you may look into something like jqGrid.
First thing to do is define more clearly what you need to do.
It sounds like you need to add functionality to an existing web app that "displays a quote for a set of products" (like a shopping cart page), that is already saved in a database.
The functionality you need to add (I think), is a feature to convert the information for the quote from the database - into a particular file format (specified by the third party app that will import the information).
Is that correct, or is the scope of your task larger / smaller?
Related
I have inherited a mostly c# MVC application that has been around for years and is quite the collection of mySQL, stored procs, Web Forms, MVC, WebAPI, JS, jQuery, Angular, and I think there is some React in there as well. I am looking for a tool where I can start the application, get to a particular page, then look at what classes and methods were called to get there.
I know the application needs refactored and, frankly, completely rewritten, and that is happening. We just also need to support this tool as another team develops the next version.
Thanks,
Sammer
You can use my Runtime Flow tool to quickly find C# classes and methods responsible to display a particular page.
I have a fairly high level design question. I'd like to come up with a framework for creating multiple very similar ASP.NET MVC sites.
These sites would be for selling various consumer goods, with each goods category having its own site (this requirement is fixed). Different category sites would mostly be quite similar - essentially a series of static pages that allow drilling down into various subcategories to view product listings, with some simple forms for expressing interest in a listing (for example).
However, it's vague at this point exactly how similar these sites might be, so I need a degree of flexibility
I come from a React background- so my vague initial thought is that the best way to approach this would be creating a library of common components used across the sites - these would range from fairly low level ones for, for example, a table of specifications, to higher level ones that might cover an entire page. The library consumer could pass in the specific apis used for the components/other specific data. I don't have much experience with the ASP.NET MVC framework, so I'm not yet certain exactly how that would work.
My question is: does this sound like I'm on the right track with this approach?
Any alternate suggestions? Also, are there any particular ASP.NET MVC features that would be key to an approach like this? (Not sure yet whether I'd use the older .NET Framework MVC, or .NET Core- any features of either that would favor one or the other for this?)
Thanks so much for your time, I appreciate the help!
There's frankly all kinds of ways to do this, and you may choose one, some, or all. For common classes (entities, helpers, etc.) you can create class library projects. You can also share controller code this way as well. Making smart use of generics will allow you reuse greater amounts of code. Sharing views is a bit more complicated, but there are ways to do that, such as RazorGenerator or NuGet packages. NuGet packages should be used to share static resources, as well, such as images, JavaScript, stylesheets, etc. Alternatively, you can host these on a CDN or other centralized area and reference them from there (use configuration to set path/URL, so you don't hardcode static paths all over the place).
As far as framework choice goes, ASP.NET Core provide a bit more than MVC in the code reuse category. You can create custom middleware, view components, tag helpers, etc. ASP.NET MVC has somewhat similar capabilities (HTTP modules, child actions, and HTML helpers), but it's arguably a bit more difficult to reuse those components/create them in the first place. Other than that, though, choice of framework really doesn't matter.
As the Definition of MVC, what you say that "creating a library of common components used across the sites" are content in the model and controller part. MVC has nothing special from other OOP approaches, but just specify that you are going to divide your abstract classes into three different category: Model (which define the container of data), View (which define the appearance of the program) and Controller (which define the behaviour of the program).
MVC is just a pattern but not a technology. For example one of the web-application I worked on in the company, the MVC structure followed as: ExtJs frontend (it has it's own controller written in javascript to call our API, therefore all itself could already be called as a "MVC" program), C# API server backend which linked back to our database (both Oracle and Microsoft SQL). As you can see, all of these components can be replaced by something else (for instance, you can use Angular2 replace ExtJs, you can use java or php replace the C# API server, and so on).
I have searched for this topic, and can't find anything that answers my needs, so I am assuming I may be looking at this the wrong way. Keep in mind, I was a classic ASP developer for 13 years, so I am used to having control over all of my code.
I have many forms on my sites for updating data: Customer information, Supplier information, Product information, User information, etc., etc. I used a library I wrote which made it easy to simply build a form, set the values, and it created the update script automatically. However, in ASP.Net, it just doesn't seem this is the way to do it.
ASP.Net, seems to have wizards. Personally, I don't like that approach. I like full control. I don't even like the ASP.Net validation controls...
Option 1: Build classes with update methods. Build a standard ASP.Net form, which will update the data through the class?
Option 2: Use the annoying GridViews, DataAdapters, wizards, etc., etc.
Option 3: Standard form, with AJAX, calling a WebMethod with the class to update data.
Which approach is most standard now (or most practical)? Which one has the best control as well as security? I don't like wizards, and I like to know exactly what's going on, so when something "doesn't go on", I can figure out why without going through a wizard. I want to be efficient with creating forms, so I can create them quickly but still have the flexibility to customize and control what's going on from user interface, to validation, to security.
It sounds like you want something like ASP.NET MVC instead of WebForms. It gives you much more fine-tuned control over the HTML content you produce, but at the same time it has some very flexible and powerful features that make it easy to perform common tasks.
You should look at things like FormView and DetailsView. They work with data source controls like the SqlDataSource control to automatically generate the SQL to interact with the database. No code involved.
If you already have a ASP Classic library, can you not just port that to a .Net library and continue using it. If you have code that works and you are happy with it no need to throw it away just because it might not be exactly the "correct path"
i need to update client on any changes occurred on server.
for that i found 2 approach.
1. using ajax which is also known as reverse ajax for this purpose.
2. using COMET.
but i don't know exact difference in both.
my site contains news content and i want that news to be automatically updates when new news is entered by my CMS application.
i have got hundreds of concurrent users on my web application.
please suggest me which approach should i use to get best solution.
also please provide me good example's like for that so that i can implement it.
NOTE: i am using .net framework 2.0 but if its not possible in 2.0 then can also move to 3.5
Thanks.
First start with YAGNI principle. See if it is ok for your client to update periodically, lets say every min or every 30 seconds. Consider things like how much information users can process in this interval. Also take a look at popular news site and how they implement this feature. In this case you are better off using the pull model where your client updates itself by requesting data from server. Implementing a push model is much more complicated.
Once you are sure that you need the push model, IMO comet is a better option. Coment is designed for this purpose. Dojo Foundation's CometD is a widely used library for this purpose. One good example is the live chess application on chess.com
Also, though I am not 100% sure about this, I believe you will need to use technologies like ASP.NET MVC which will allow you more control on the markup generated by your web app so that you can use these libraries.
I've been looking around for a simple solution to this, trying my best to lean towards something like NHibernate, but so far everything I've found seems to be trying to solve a slightly different problem. Here's what I'm looking at in my current project:
We have an IBM iSeries database as a primary repository for a third party software suite used for our core business (a financial institution). Part of what my team does is write applications that report on or key off of a lot of this data in some way. In the past, we've been manually creating ADO .NET connections (we're using .NET 3.5 and Visual Studio 2008, by the way) and manually writing queries, etc.
Moving forward, I'd like to simplify the process of getting data from there for the development team. Rather than creating connections and queries and all that each time, I'd much rather a developer be able to simply do something like this:
var something = (from t in TableName select t);
And, ideally, they'd just get some IQueryable or IEnumerable of generated entities. This would be done inside a new domain core that I'm building where these entities would live and the applications would interface with it through a request/response service layer.
A few things to note are:
The entities that correspond to the database tables should be generated once and we'd prefer to manually keep them updated over time. That is, if columns/tables are added to the database then we shouldn't have to do anything. (If some are deleted, of course, it will break, but that's fine.) But if we need to use a new column, we should be able to just add it to the necessary class(es) without having to re-gen the whole thing.
The whole thing should be SELECT-only. We're not doing a full DAL here because we don't want to be able to break anything in the database (even accidentally).
We don't need any kind of mapping between our domain objects and the generated entity types. The domain barely covers a fraction of the data that's in there, most of it we'll never need, and we would rather just create re-usable maps manually over time. I already have a logical separation for the DAL where my "repository" classes return domain objects, I'm just looking for a better alternative to manual ADO to be used inside the repository classes.
Any suggestions? It seems like what I'm doing is just enough outside the normal demand for DAL/ORM tools/tutorials online that I haven't been able to find anything. Or maybe I'm just overlooking something obvious?
You might want to investigate this:
http://www.codesmithtools.com/
I've been on a few projects where this tool was used, and the developers were fond of it.
Warning: it's not freeware.
Adding to code4life's answer.
I recently used CodeSmith 2.6 on a pet project at home.
I tailored the templates to generate Partial classes with partial CRUD methods.
I then extended the partial classes and partial methods to provide basic mapping e.g. when "Order" is read, read the associated "OrderLines" etc.
A similar approach might work for you, and be simpler because really, you only want the R of CRUD :)
Hope this helps.
P.S. I need to switch from CS 2.6 to something else (possibly MyGeneration), as 2.6 is dependant on .Net 1.1, which is a problem as I'm moving to a 64 development machine.
UPDATE
I hear ya.
Have a good poke a MyGeneration mate, we use CodeSmith here in work, which is why I went for 2.6 at home (I'd a quick glance at MyGeneration, didn't get it immediately - which was more time than I had to give it - so switched back to CS).
MyGeneration is basically an open source version of CS.
Also, why not get it to generate the code ALWAYS - you can tweak to your hearts content with Partial Classes & Partial Methods, I know you think re-generating is overkill, but experience tells me it's one of those things that if you don't it have you'll need it, where as if you have it and need it you'll never notice.