strongly-typed

Initializing strongly typed objects in LINQ to Entities

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...

Is it possible to refer method like property? Like Validate(x => x.Property)

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...

(strongly vs weakly) typed AND (statically vs dynamically) typed languages and Moore's law

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...

Better way of doing strongly-typed ASP.NET MVC sessions

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]...

Strongly Typing a LINQ Query using multiple keys of complex objects

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...

Strongly typed links in ASP.NET MVC 2.0 beta

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...

ASP.NET MVC strongly typed view convert from C# to VB.NET

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>...

Use strongly typed data rather than a string to bind to a drop down list

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...

Strongly-typed languages for web programming

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? ...

ASP.NET MVC Two Way Data Binding of Model to Radio Button List using Typed Model.

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...

Is there a way to define C# strongly-typed aliases of existing primitive types like `string` or `int`?

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...

Why are interfaces not strongly typed?

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() ...

Strongly typed htmlhelper & spark

I read that it's possible, but didn't get idea how. Any ideas? ...

Need help on Strongly type View

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 ...

What asp.net-mvc strongly typed helpers uses underneath?

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? ...

Why do programming language allow assignment from integer to shortint?

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...

asp.net get Strongly Typed from string

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? ...

Strongly-typed or weakly-typed binding in codebehind in front end?

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...

WCF Rest Service: Tool for creating strongy typed classes via the help pages?

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? ...

What are the use cases for this static reflection code?

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...