ADO.NET :: Practical Technique For Dealing With Null Entities?

Feb 27, 2011

In my new ASP.NET EF4 project, I find myself having to do a lot of maneuvering around null entities. For example, I may have a Project Entity with a related User Entity exposed through an Assignee property. Suppose I need to send an email to someone indicating who the Assignee is, I need to say:string x = "The Assignee is: " + TheProject.Assignee.Name;but I'll get an exception if there is no Assignee as the property is null (I want nulls by design) and I can't fetch the .Name property on that null.

View 4 Replies


Similar Messages:

C# - Check The Null Of An Embedded Linq To Entities Statement?

Dec 15, 2010

Using linq to entities i am connecting to a database, the database has tables in it that has payments that have a multi to multi relationship with jobs. This is acheived via an allocs table. I want a list box with all the jobs that has a column called due price which takes all of the allocations of payments for this job and takes that away from the job price. However, using the below linq to entities statement. The problem is that if the job has no allocations it returns null and therefore the due payment is empty. What i really want is for the due payment to be the job price if there are no allocations however, i cannot think of a way around this.

var jobs = from j in data.jobs
where j.property.customer.id == customerid
&& j.completed != null
select new
{
j.id,
j.price,
dueprice = j.price - ( from a in data.allocs
where a.job.id == j.id
select a.amount ).Sum(),
lineone = j.property.lineone,
postcode = j.property.postcode,
jobtype = j.jobtype.name,
j.completed
};

View 3 Replies

ADO.NET :: EF4 Entities / Create Entities, For Instance, That Only Contains Contact Details Of Client Table?

Nov 16, 2010

I have a datamodel with a couple of tables. One of my tables have about 40 fields (I know that is a lot, but we have to keep the structure in place as we are upgrading a classic ASP project to MVC). Some of my Actions only updates 1 or 2 fields in my table.

Is there a way to create Entities, for instance, that only contains the contact details of the client table, and not any other details, and then another entity that contains only the address details. I don't want to submit the entire row when I only update telephone details, or the client's picture.

View 1 Replies

Practical Limit Of A Textarea?

Jan 14, 2011

Using IE6+, what is the maximum amount of text you can POST with a <textarea> before something breaks?

Edit: The answer I'm hoping for is "there's no way you could actually type something meaningful and unmallicious into a textarea and crash Internet Explorer."

View 3 Replies

Practical Application Of Convention Vs Configuration

Apr 18, 2010

but here's a case in point that I'd like to share and get input on. Below are two entities, coded like normal.

Csharp Code:
using System.Collections.Generic;using SharpArch.Core.DomainModel;namespace Venue.Core{public class Category : Entity{private virtual IList<Forum> forums = new List<Forum>();public virtual int Sequence { get; set; }public virtual string Title { get; protected set; }public virtual string Description { get; set; }public virtual bool Enabled { get; set; }public virtual bool Visible { get; set; }public virtual IEnumerable<Forum> Forums { get { return forums; } }public void AddForum(Forum entity) { forums.Add(entity); }public void RemoveForum(Forum entity) { forums.Remove(entity); }public Category(string title){Title = title;}}}
[code]...

View 10 Replies

Practical Advantages Of Precompiling A Website?

Mar 15, 2011

What are the practical advantages of precompiling a website?

View 3 Replies

DataSource Controls :: SSIS And SSRS Practical Use?

May 13, 2010

want to know about SSIS,SSRS and what is the use of them,how to use them practically

View 3 Replies

Databases ::asp.net 2010 And Mysql Are Practical For 10 Million Records ?

Aug 12, 2010

I am developing a large e-commerce system.

I am using asp.net 2010 with mysql database. Is it practical for large amounts of data ? say 10 million records ? cuz some people said to me that using this combination, i'll be having performance issues as database grows.

View 4 Replies

Self Tracking Entities Vs POCO Entities

Sep 28, 2010

We are starting a new web based product in which we are planning to expose our business logic through WCF services. We will be using ASP.NET 4.0, C#, EF 4.0. In future we want to build iphone applications and WPF applications based on the services. I have been reading a lot about using POCO vs Self Tracking Entities (STE) and from my understand the STEs do not work well with the web scenario.

View 3 Replies

Sql - Dealing With XML In MVC?

Jan 21, 2010

I have a block of XML in a database which is easy enough to pull out using ASP.NET MVC, however I would like to access and modify the XML in an way more consistent with class instances. Is there a way to get the MVC (or any other model) to generate a data access (or perhaps Entity) class set from the DB-stored XML?If the above is rather obtuse, the question could be summarised as; What method would you use to best access and modify XML stored in a database from an ASP.NET MVC application?

View 1 Replies

.net DataReader Execution Technique

Jan 3, 2010

I heard that DataReader works on forward only readonly fashion and at a time it willread a single record.Suppose when i execute the below code

SqlDataReader reader=cmd.ExecuteReader();
gv1.DataSource=reader;
gv.DataBind();

How the does the gridview populate all records?.As the reader is capable of reading one row per read,I thought only the last row is available for GridView to display.

View 3 Replies

MVC :: Using NHibernate For Dealing With The DB Interactions?

Jan 21, 2010

Im currently starting on a project where im using NHibernate for dealing with the DB interactions, and MVC2 (RC) for the front end... and im just wondering if there are any decent tutorials on how to minimize the amount of duplicated validation that needs to be entered to validate thigns in NHibernate and try to mirror those constraints client side.. Ive looked at xVal which looks great, but i cant seem to get it to work and there dont seem to be that many articles about it. Also alot of people are mentioning that its going to become redundant at the MVC level in MVC2 due to the data annotation validation. So im really just after some more information/advice and links on the subject really...

View 2 Replies

Controls That Replicate Following Databinding Technique

Apr 20, 2010

Nifty and free asp.net controls that replicate the following databinding technique? [URL]

View 11 Replies

MVC :: Web.config Work / Equivalent Technique?

Aug 17, 2010

I would like to secure any URL below the http://MyServer/Admins and limit it to a specific role.

In webforms it was straight forward. I just put a child web.config in the /Admin/ folder and add <authorization> <allow roles> tags to it.

How would be the equivalent technique in MVC?

View 5 Replies

Dealing With Screen Scrappers And Bots

Oct 4, 2010

I got a bot and screen scrapper problem. I have successfully redirected them somewhere else, but they still show up in my stats. I run my redirection code in the pre init section of the master page. I use discountasp for my hosting provider. Is there a way to run my code before the preinit page section?

View 8 Replies

MVC :: Create Paging When Dealing With Postbacks?

Mar 31, 2011

I have the following scheme: a View (comming from an action method) called EventSearch that contains a DropDownList of PowerPlants, a ListBox with GeneratingUnits, a DropDownList and two TextFields to set the timespan (you can choose a predefined timespan in the DropDownList or set your own in the TextFields). The model for this page is a DataQuery (an object to be tested against the Database to search the matching values). Clicking in a button in this View will cause a POST.

Then, in another View, called EventList, with the Model being List, I render the above Action, so the user can trigger a search in the same page he visualizes the results.Usually, the number of itens in the list to be displayed in EventList is massive, so I wanted to give paging a try:

[Code]....

when I try sorting or even change page, the results don't get displayed. Here is my ActionMethods for EventList:

[Code]....

I don't know if it doesn't work by the way I created the pages (using this DataQuery object) and if there is another way out of this problem.

View 3 Replies

Best Technique To Search Text For List Of Word

Oct 1, 2010

i have table contain two column id and word .word column may contain one word or two or three ex ( computer , computer software , computer software computer )i want search the text if it contain any word in that table .

View 2 Replies

Localization :: Which Technique Is Used In Handling Multilingual Implementation

Apr 19, 2010

Which technique is used in handling multilingual implementation? What is the best way to implement it?

View 3 Replies

Is JQuery The Best Way Of Dealing With User Interaction In C# .net Environment

Oct 8, 2010

.net has all these build in GUI elements. The purpose is that we build a .net web application and for the coding itselve I'm very familiar with jQuery in PHP but I noticed that in .Net everybody starts using it too.Is jQuery the best way these days to deal with this in .NET (c#)? or are there others you might recommend?

View 5 Replies

C# - Login Control - Dealing With Brackets In Passwords?

Jul 9, 2010

I'm using the standard asp:Login control, and we have a user who recently changed her password to include an angular bracket. When she tries to login, she gets an error message, and I get the standard 'dangerous request' exception.

I know I can set ValidateRequest="false" on the page to negate this, but I was hoping someone knew of a better way.

View 3 Replies

Web Forms :: Dealing With Session Time Out While Using Modules?

Dec 20, 2010

We are using cutesoft AJAX uploader. The uplodaer is implemented using HTTP Modules. Everything works well. The problem is that if the user clicks the upload button after being idle for long (means after session time out) the control throws and error.

I just want to know the work around to bypass this issue.

Note:- We are just using one web.config and two master pages (one for login and error pages and one for all other pages which are accessed after authentication). We have written the code to check the session timeout in oninit of the master page which is used by all the pages except (Login and Error pages).

View 4 Replies

Architecture :: Web Application For Dealing With Client Resources?

Aug 13, 2010

I am planning to convert desktop application which has to deal with lots of client resources like printer, Id scanner(driver license,passport & business card etc.), webcam etc.Now accessing client resources like files, scanners and webcam everything has to be done through client side scripting which is really pain. Due to nature of this product, I have to create image on client PC and extract information from it. (This is also pain in Vista and Windows 7 due to security permissions and all that stuff).

My ideal design would be making managed dll which takes care of dealing with images, printers, webcam (I have to apply pan, tilt and zoom), id-scanners. This is kind of component. And GUI would be web based Asp.net which simply calls the functions of managed dll. If the end-user is opening application on new computer, then it will ask just like flash or silverlight that you have to install component locally for the first time.Points which I worry: 1. If it logically correct or sounds stupid? 2. How to install managed dll at end-user's PC (C:/program files) and use it from asp.net code behind page.

My application is intranet application.so avoid stupid assumptions about privacy and ohhooo you want to access files from my PC and all those stuff. (end-user would never mind in giving credit card to restaurnt waiter who could do anything with it behind counter but allowing web application to access file which is created by application is privacy issue)

View 1 Replies

C# - IHierarchicalEnumerable The Prefered Way Of Dealing With Hierarchical Data?

Dec 14, 2010

I'm building an asp.net mvc app, I want to build up an hierarchical structure, is IHierarchicalEnumerable and IHierarchyData the best way to implement a hierarchical structure?

View 1 Replies

Finding Mvc Highlighting Current Page Link Technique?

Sep 4, 2010

I need to highlight active link in the menu. My menu is in the master page by the way. I'm looking for the best way to implement this?

View 3 Replies

.net - Technique Of ASP.NET Session Access Multi-user Is Safe?

Mar 9, 2010

I am looking at a design pattern which has come up in quite a few of my firm's projects.It has historically functioned correctly, however I have heard some other developers argue that there is a possibility of session corruption using this pattern. I'm looking for insight from other .NET developers here on Stack Overflow. Basically, there's a class -- usually either static or a Singleton pattern, depending largely on the developer who wrote it -- stored in App_Code.This class encapsulates access to the current session via properties.All of these properties take the form of:

[code]...

However,because this is just a static entry to HttpContext.Current.Session,it seems like it should be safe, as it is not fundamentally any different than the Page class encapsulating this in the Session property.As I said,no other site on which my company has worked that used this pattern saw it ever have any issues -- and that includes some pretty large and highly active userbases.But I want to just get a fresh perspective.
Are there potential multi-user issues, race conditions, or other failings/flaws which specifically could cause session corruption in the above pattern?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved