I have a plain old CLR object which is essentially a wrapper for two entity framework objects, I'm doing this so I can pass this wrapper object to a strongly typed view in the MVC framework. My foo wrapper class is very simple:
public class FooWrapper
{
public FooWrapper(Foo f, Bar b)
{
this.FooObject = f;
this.B...
Because I need to build a very strongly-typed & type-safed project for Asp.net MVC. But I found that a lot of syntax in View page isn't type-safed variable. Please look at the following example.
BeginForm("LogOn", "Account")
instead of
Form.BeginForm(x => Account.LogOn)
Is it possible to create something like above code? It's a ver...
Hello all, I do not know how many faces this problem. If I do programming in weakly/dynamically typed language like python,php,javascript for few days I lose touch with strongly typed languages like c++,Java,.net. I recently heard languages like python and ruby which people loved programming in.
It is very easy programming in weakly/dyn...
I am developing an ASP.NET MVC project and want to use strongly-typed session objects. I have implemented the following Controller-derived class to expose this object:
public class StrongController<_T> : Controller
where _T : new()
{
public _T SessionObject
{
get
{
if (Session[typeof(_T).FullName]...
I can't figure out how to define the object used in my LINQ grouping query to allow them to be strongly type.
I've build a grouping query that uses two complex objects as keys. The query works, but I would like to be able to declare the return object type.
I have a complex type...
Public Class Student
Public Name As IndividualsNa...
With ASP.NET MVC 1.0 I always have been able to generate strongly typed links in my Views using a lambda function:
Html.BuildUrlFromExpression<TController>(c => c.Action(arg));
I'm now upgrading to ASP.NET MVC 2.0 beta and I can't find any strongly typed extension for the HtmlHelper (nor the UrlHelper in fact). Have they been replaced...
I'm starting to learn ASP.NET MVC and since I work in a VB.NET shop I'm converting an example from C#. I'm trying to implement a strongly typed view and the example I'm looking at shows the following:
<tr>
<td>Name:</td>
<td><%=Html.TextBox(x => x.Name)%></td>
</tr>
I've come up with the following in VB.NET:
<tr>
<td>Name:</td>...
Given the following class....
namespace IMTool.Data
{
public partial class AllContracts
{
internal class Metadata
{
public int ContractId { get; set; }
[Required]
public string Name { get; set; }
}
}
}
and given the following.
using (var context = new IMToolDataC...
Are there any strongly-typed programming languages for the Web? I program in PHP now, but often I wish it yelled at me when I tried to compare a number to a string. Functions in the standard library that can return either a bool or an integer don't make anything easier either.
I know there's .NET, but is it my only choice?
...
I have a mvc view made up of a matrix of radio buttons. Each row of radio buttons is in a group and represents a typed object from the model. Using the guidance of various blogs and postings I have successfully bound the posted form results to the typed model array in the controller action, however cannot seem to successfully reverse t...
Perhaps I am demonstrating my ignorance of some oft-used feautre of C# or the .NET framework, but I would like to know if there is a natively-supported way to create a type alias like EmailAddress which aliases string but such that I can extend it with my own methods like bool Validate()?
I know of the using x = Some.Type; aliases but t...
I have the following code compiles without issue. Of course, I get an invalid cast exception when executing the Dim C As IDoThingsC = GetThing_C(). Am I missing something? Would you ever want to return an object that does not meet the interface requirement for a function return value?
Public Class ClassA
Public Sub DoThings_A()
...
I read that it's possible, but didn't get idea how.
Any ideas?
...
I am following ScottGU tutorial : A Simple E-Commerce Storefront Application
http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx
I can't get data from ViewData in my strongly-typed view Categories.
I really don't know what I am doing wrong because I am following ScottGU tutorial.
I am using the latest ...
For example, if i use this in view:
${Html.TextBoxFor(u=>u.UserName)}
How can i
var name = [xxx].NameFor<User>(u=>u.UserName);
from elsewhere? Is that possible?
...
program TypeCategory;
{$R+}
var
sInt : shortint;
iInt : integer;
begin
readln(iInt);
sInt := iInt;
writeln(sInt);
end.
Considering the above example,pascal language do allow assignment from integer to shortint,or even longint to shortint without explict type casting.That is,pascal do allow assignment inside type cat...
My error code:
string model = "Content";
Type stype = Type.GetType("mvc.Models." + model);
ViewPage<stype> vp = new ViewPage<stype>();
Of course it error when compiling, but it clearly show what i'm thinking. Can i do this?
...
So my question is more in relation to what people consider to be the best practice and why:
I've been dropping literals into pages and repeaters and binding them in code behind for a while. Is this considered bad practice?
ie:
ASPX Page:
<asp: Literal id="litTextToInsert" runat="Server" />
Code Behind:
litTextToInsert.Text = objDat...
Hi there,
can anyone tell me if there is a tool for creating the strongly typed classes (available via the schema) - i suppose similar to Paste as XML type ..
But i was hoping for a tool that i could run to automatically update the classes automatically when there are changes
Does anyone know if something like this exists?
...
This is Oliver Hanappi's static reflection code he posted on stackoverflow
private static string GetMemberName(Expression expression)
{
switch (expression.NodeType)
{
case ExpressionType.MemberAccess:
var memberExpression = (MemberExpression)expression;
var supername = GetM...