Cached Entities Making Round Trip To Database?

Jan 9, 2012

i am caching objects, if i make linq queries on cached entities then... will theses queries make database round trip due to lazy loading in Entity framework?


Communications :: Show Ping Round Trip Time?

Nov 8, 2011

I am trying to figure out how to show the round trip time it took to ping a server. I know the following code conducts the ping and that the 1000 is for the miliseconds however I can't seem to figure out how to capture the time it took.

If My.Computer.Network.Ping("",1000) Then
MsgBox("Server pinged successfully.")


View 8 Replies View Related

Get Primary Key Id Number From Table WITHOUT Making A Second Trip?

Jan 18, 2010

How would i get the primary key id number from a Table WITHOUT making a second trip to the database in LINQ To SQL?

right now, i submit the data to a table, and make another trip to figure out what id was assigned to the new field (in an auto increment id field). I want to do this in LINQ To SQL and not in Raw SQL (I no longer use Raw SQL).

also, seond part of my question is: i am always careful to know the id of a user thats online because i'd rather call their information in various tables using their id as opposed to using a guid or a username, which are all long strings... i do this because i think that SQL Server doing a numeric compare is much (tentative use of the word 'much') more efficient than doing a username (string) or even a guid (very long string) compare.

View 5 Replies View Related

Round Up The Numbers - Round Up The "TotalVolume" And "AvgHL" With 2 Decimal Places

Apr 27, 2010

With the following problem which I want to round up the "TotalVolume" and "AvgHL" with 2 decimal places. However, my ListView2 is still showing as the following example.

ID --------- Average H/L ----------- Average Volume
12 --------- 1.230000 ----------- 4251.230000
17 --------- 0.560000 --------- 12345.560000
23 --------- 0.320000 --------- 2345.010000
54 --------- 1.230000 --------- 122.550000

Dim conn As SqlConnection
conn = New SqlConnection(Source)



View 6 Replies View Related

.net - Using .Contains Method With Cached Hashset

Jul 26, 2011

I know that the .Contains method on a hashset is fast. My question is what is the best method for getting the hashset data before repetitively using the .Contains method?

I can think of 2 options. Both of these examples would be called in a loop of undetermined length.

1) Call the method that returns the cached hashset directly and use the .Contains method.

IF (GetHashSetMethod.Contains("TESTVALUE") THEN BLAH, BLAH, BLAH...

2) Create a new hashset outside of the loop and load the cached hashset data into it so the method that returns the hashset is only called once, then use the .Contains method.

DIM HashTest AS HASHSET(OF String) = GetHashSetMethod

Then in loop:

if (HashTest.Contains("TESTVALUE") THEN BLAH, BLAH, BLAH...

I have been using method 1. Should I even think about switching to method 2? Is there a 3rd option I haven't even thought of? Does it even matter because the data is cached to begin with?

View 2 Replies View Related

IDE :: Cached Items In Toolbox?

Jun 10, 2010

I have a rather large project that several developers access via MS SourceSafe. The issue at hand is the ToolBox lists many, thirty plus, items that start Cached.(the name that follows Cached is the name of a class or Cyrstal Report in the project.There are also many items listed, they have the same "gear" icon, without the word Cached prefix on the class name.

My question is, how can I get these items out of the ToolBox so they never come back?

View 3 Replies View Related

Is Size Of Lists Cached In Some Way

Jan 17, 2010

Is the size of Lists cached in some way (calculated the first time you call it, and then retained untill some change is made to it), or does it get calculated every time you call the Count property? Same question for arrays.

View 11 Replies View Related

Linq2SQL Counts Getting Cached?

Sep 23, 2009

I've got a very simple data structure. I'm using SQLExpress with Linq2SQL and



View 1 Replies View Related

Reading Cached Images?

Jan 31, 2012

I've been working on my own web browser for a few years now using the webbrowser control in VB.Net.The following routine allows me to pull images on a web page that are stored in the cache:

Private Function GetCachedURLPath(ByVal lpszUrl
As String)
As Boolean


This routine has worked well for me, but there are some pages where it is unable to pull the image from the cache. What discovered is that when a web page host images on a different server than the page hosting server, the images get stored in the cache with the address from the image server instead of the src address listed in the IMG tag. Given that I am using the URL from the src in the IMG tag, the routine fails to provide a return path.In most instances reloading the page puts the image into the cache with the same address as the scr record. It was fairly easy to write a routine that automatically reloaded the page when I could not find the image in cache, but one of the things I want to address in my latest revision is this issue.

I have a routine that allows me to run through all of the URL's for the files stored in the internet cache and using that I can figure out the correct URL for a picture, but this seems to me to be about as cumbersome as reloading the page and can be time consuming if the page has a lot of images.I can cut down on the time if I modify the routine to only run through the list on exceptions, but this just seems inefficient to me, especially since I have to make an assumption about what part of the image URL's are the same. What I'd like to do is to track the sources of the images as the web page is being drawn so that I have a listing of all the real source URL's for the images instead of having to rely on what is referenced in the src attribute.

View 5 Replies View Related

SelectList Cached By AJAX?

Sep 20, 2011

I have a DropDownList in MVC which grabs a SelectList initialized and populated by a controller. The goal of the specific page that said list resides on is to reply "You have selected option X" immediately to the user without refreshing (using Ajax).The problem I'm running into is that for some odd reason, while the dropdown renders properly and even posts back correctly, any attempts to add new options or modify previous response messages are in vain.

My View:
<script type="text/javascript" src="../../Scripts/MicrosoftAjax.js"></script>
<script type="text/javascript" src="../../Scripts/MicrosoftMvcAjax.js"></script>


View 1 Replies View Related

Cached Objects Staying In Memory?

Mar 24, 2010

I have a web forms app that uses System.Web.Caching.Cache to cache xml data from a number of web services for 2 hours.

webCacheObj.Insert(dataCacheKey, dataToCache, Nothing, DateTime.Now.AddHours(2), Nothing)

Every 90 minutes a Microsoft Search Server hits a particular (spider) page which calls the code to put the objects into the cache.The issue i have is that over a period of time, the memory usage of the application grows exponentially. Lets say that in a week, the memory usage of the application pool grows to over 1gb

View 1 Replies View Related

Repeater And Cached Dataset - Only Last Row Shown?

Jan 13, 2012

I have a relatively simple piece of code as follows:

Dim oShow As DataSet = Nothing
Dim cacheKey As String = String.Format("AsyncCacheFor_agenda_{0}", ShowID)
If Not IsNothing(Cache(cacheKey)) Then


View 2 Replies View Related

Implement A Non-cached File Copy Using 2005?

May 7, 2009

I have a program I wrote that copies select files from one remote computer to another.
The set up I for testing is, one computer(a) at home running the program connected to my work's network via VPN and two computers(b,c) at work side by side on the same network. I am trying to copy the files on computer b to computer c, while the program is running on computer a.

The only thing wrong with this is, the files seem to be caching to a temp folder on computer a then going to computer c. When it should be going straight from computer b to computer c. Is there a way to keep the files from trying to cache on the computer running the app?

View 1 Replies View Related

Keeping Tables Cached On Server In Project

Mar 7, 2010

I have an ASP.NET project which is a front-end to a database. In addition to the large tables, the DB contains a few small tables to help normalize the larger tables with common values. I have a VB.NET project which loads the smaller tables into memory, using "Shared" (i.e., "static" in C#) member variables, and uses them. I have a call to load the tables in Global.asax - Application_Start. This works for a while. That is, Application_Start runs when I first run my project, loads the cached values, and will correctly keep them in memory for a while.

What I'm seeing (when running my project via Visual Studio 2008 Debugger, hosted locally) is:

A) The Application_Start code will run more than once. Not in a row, but after the user has navigated to some other pages, I'll see (my breakpoint in) another call to initialize the cache, coming form Application_Start. Is it expected?

B) The "Shared" variable that was set to True when the cache was initialized is now False again (which should only happen when the class is first loaded). Similarly, all the data that was chached is no longer present. That is, it looks like VB is unloading all the Shared members. Is this expected?

View 1 Replies View Related

Syntax To Change The Value Of A Cached Object Property?

Jun 6, 2010

In an ASP.NET 3.5 VB web app, I successfully manage to cache an object containing several personal details such as name, address, etc. One of the items is CreditNum which I'd like to change in the cache on the fly. Is there a way to access this directly in the cache or do I have to destroy and rebuild the whole object just to change the value of objMemberDetails.CreditNum?The cache is set using:

Public Shared Sub CacheSet(ByVal key As String, ByVal value As Object)
Dim userID As String = HttpContext.Current.User.Identity.Name
HttpContext.Current.Cache(key & "_" & userID) = value
End Sub

View 1 Replies View Related

RemoveAll Is Also Changing Previously Cached Data That It Should Not Be Able To Change?

Apr 28, 2011

This has been driving me insane all day and I think I have the problem narrowed down, but it just doesn't make sense how it could be happening. I have 2 public shared functions and 2 private shared functions. One provides a list of custom objects and one filters the objects based on some parameters in the function call. Both return List(of custom object). The 2 private shared functions are the predicate functions used in the List(of t).RemoveAll function.


Now, the next time I call the GetItemList function it only returns 50 item objects, not the 100 item objects that it should be returning due to the cache being set! I have verified this in the debugger and by running many, many different tests to see what combinations of parameters may be causing the problem. In my testing, as soon as one of the .RemoveAll functions is used the GetItemList item list will get set to whatever the NarrowItemList function returned.

Even if the cache wasn't being set correctly, shouldn't it just get the data again from the database and return 100 items again? What could I be missing???

View 2 Replies View Related

UserPrincipal.Current.ChangePassword Does Not Update Cached Credentials

Jun 29, 2010

I'm writing a program which assists users update passwords for our windows systems and some other applications. Everything is working except when I call theUserPrincipal.Current.ChangePassword command cached credentials are not updated like they are when you change a password using the windows OS password change.

That is: when a remote user who is VPN'd in uses my application to change passwords, when they reboot and VPN is disconnected, they are forced to login to windows using there old password.

Is there a way I can force windows to update the cached credentials to the new password so upon reboot they are able to login using this new password?

View 1 Replies View Related

Web Browser Control Working Offline - (Cached Web Pages) Only?

Aug 18, 2011

Is there a way to work the web browser control for viewing off-line (Cached web pages) only? Is it possible to view cached web pages from IE9 on a web browser control off-line? The reason i am asking this question is because IE9 automatically switches from off-line mode to on-line mode when it cannot find something in the cache by default. For forensic purposes this is not acceptable for these reasons: Active content (Viruses, java script, activex cookies etc)

View 1 Replies View Related

Fastest Alternative To Datatable.Select To Narrow Cached Data?

Sep 28, 2009

I have a search function on my company's website (based on .NET 2.0) that allows you to narrow the product catalog using up to 9 different fields. Right now, after you make your selections on the frontend I am building a dynamic query and hitting the database (SQL Server) to get the resulting list of items numbers. I would like to move away from hitting the database everytime and do all of this in memory for faster results. Basically a 3500 - 4500 row "table" with 10 columns: the item number (which could be a primary key) and the 9 attribute fields (which have repeating values for many many rows).

There can be any number of different searches between the 9 columns to get the items you want:
Column A = 'foo' AND Column D = 'bar'
Column B = 'foo' AND Column C = 'bar' AND Column I = 'me'
Column H = 'foo'

Based on my research, the .Select() function seems like the slowest way to perform the search, but it stands out to me as being the quickest and easiest way to perform the narrowing searches to get the list of item numbers:
MyDataSet.Select("Column B = 'foo' AND Column E = 'bar' AND Column I = 'me'")
In my specific case, what method I use as an alternative that has the same narrowing functionality and better performance instead of settling for the method?

View 2 Replies View Related

Sql Server - Rolling Back Entity Framework Transaction, Cached Item Persist?

Aug 23, 2011

I'm using an Entity Framework context, and sometimes would like to create a transaction so that the client can do multiple changes and then commit/rollback them all together.However, if many changes were made, and SaveChanges() was called multiple times, after which a rollback is called, entities that were commited already, will remain the way they were commited, and would not roll back.Here's how my transaction-relative functions look like:

Public Sub BeginTransaction()
Dim context = HttpContext.Current.GetObjectContext()
If Not context.Connection.State = ConnectionState.Open Then
End If


Not only does the test fail, but it also leave the ObjectContext in an unstable mode, because it still has invalid changes in it.

View 1 Replies View Related

Stepping Through All IE Entities?

Dec 21, 2011

I am quite new to VB and have a Problem. I need to step through all IE entities and extract the html source of a tab where some conditions are met.

Private Sub TabPage1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabValues.Click, TabPage1.Enter, TabPage2.Enter
Dim err = "", status As String = ""


View 1 Replies View Related

Entities And Multiple Databases?

Sep 26, 2010

We've got the following scenario:

Central Database (replicated across multiple servers)
Client Database 1
Client Database 2

The Central db has Users and Roles amongst other things The Client dbs have similar tables to each other but with some fields tweaked - contact, address, At present, each client db has its own user/role information which is copied from the central db by a scheduled process. I want to retrieve the user/role information directly from the central db instead (bearing in mind tables in the client db make reference to the user entity)

View 1 Replies View Related

Inner Join In Linq To Entities?

Apr 23, 2009

Given two tables, customer and orders, how would one do a linq query to entities to find any customers with open invoices started before a certain date?

View 1 Replies View Related

Link Up Different Entities On Submit Changes?

Nov 15, 2011

I am just digging into L2Sql and I am a little confused on what to do about inserting several records into my database that are related.

For example:

I have an entity mapped to a user table called user. This class contains UserId and Username.

I have an entity mapped to a preference table called preference. This class contains PrefId, PrefName, UserId.

I have an entity mapped to a profile table called profile. This class contains ProId, ProName, UserId.

When I ask a user to register for an account, this will populate a User object. I will then create two "blank" objects to relate to this user, a profile and a preference.

I notice that the dbml has a User property on both the profile and prefernce entities. Am I right in thinking that if I pass the User object to this property, this in turn sets the UserId for these objects?

If thats the case, when do I actually do this? Surely I would need to InsertOnSubmit the user object, query it back to get the Id and then pass this User object to the others before Inserting them?

At the moment I have this,

Dim reg As New User
reg.Username = username
Dim pro As New Profile


View 5 Replies View Related

XML Resolves Entities On Save?

Aug 9, 2010

I have a simple XML file like so:

<?xml version="1.0" encoding="UTF-8"?>
<foo attr="blah &#176; blah"/>

When I load it into the .NET XmlDocument and issue a Save, i.e.:

xmlDoc = New XmlDocument()
xmlDoc.Load("c: empar.xml")
xmlDoc.Save("c: empad.xml")

the new XML file contains the resolved amp 176 (a degree sign). This then breaks the final black box I'm trying to load the XML into. I've tried playing with the encoding, to little effect. Is it possible for the parser to just echo what came in, without resolving the entities? Inerestingly, it doesn't resolve &amp;#176;

View 1 Replies View Related

Abstraction Between Database Entities And Objects In C#?

Sep 17, 2011

I've just gotten started with development using Visual Studio (though this can be seen as a more language-generic question), and need done design answers regarding how to suitable relate a Database Entity/Table with an Class in-code.

Currently, I create a class who's attributes or iVars directly correspond to the fields in an Entity.

When I come to fetching all 'Customers from a Table' for example, I run a Select all statement against the database and for each result-row returned, I instantiate a new class Object where I use the Class' default constructor to set the instance variables. (I really wish there was a method like PHP's mysql-fetch-object()?)

I can then add each of these objects to say, a List(of Customer) and return it.

This doesn't seem like the best way to do it. If I were to change the Database schema, I'd have to reflect those changes in the class also.

View 1 Replies View Related - Concatenating String In LINQ-to-Entities?

Apr 7, 2011

This code works if I take out


Thus the remaining code looks like:


Maybe LINQ-to-Entities just doesn't support concatenating more than two strings at a time?

Protected Sub btnFilter_Click(sender As Object, e As EventArgs) Handles btnFilter.Click
Dim dbContext As Campus6Entities = New Campus6Entities


View 1 Replies View Related Mvc - .NET - Efficient Collection Of Database Entities?

Jan 15, 2010

I have a Page class and a PageCollection class in a 3d party ORM framework. I can fill the PageCollection based on parameters (pageid, parentid, url etc..) (SQL query). But I need the data multiple times around the ASP.NET MVC website (Sitemap, Authentication), so I chose to load all pages 1 time and reference that (global) collection.

GlobalClass.Pages //is PageCollection containing all pages

I have now created functions which return a temporary subcollection or single entity based on the parameters mentioned before (pageid, parentid, url etc..).

GlobalClass.Pages.GetByPageId(id) //returns single page entity
GlobalClass.Pages.GetByParentId(parentid) //returns subcollection

The site however got very slow.

cache the subcollections (GetByParent())? create internal hash-lookup tables for the collection? Something else...?

Namespace BLL
Public Class PageCollection
Inherits CustomCollectionBase


View 1 Replies View Related

Databind To A Treeview Using Linq To Entities?

Feb 12, 2010

I have seen other similar questions dealing with WPF Almost exactly the same but I can;tfigure this out in I have a Pages table with a parentpage foreign key and want to databind them to a treeview. In the past I have created a hierarchicaldataset from a dataset but would like to stay within the entities framework if I can

View 1 Replies View Related

EF4: LINQ 2 Entities Query Works In C# But Not In VB

Dec 11, 2010

the query below throws a System.NotSupportedException: "Unable to cast the type 'System.Linq.IOrderedQueryable1' to type 'System.Linq.IQueryable1'. LINQ to Entities only supports casting Entity Data Model primitive types." The exception is only raised in the VB.Net version. When translated to C#, no exception is raised.

Dim doesThisCrash = From outerOrder In orders
Where outerOrder.ProductId =
(From p In products Join o In orders On p.Id Equals o.ProductId


View 4 Replies View Related

Get CurrentTime From SQL Server With LINQ/Entities?

Sep 14, 2011

I am using LINQ with Entity Framework, and I need to get the SQL server timeCan anyone tell me how can I create a method so it retrieves the current server time?

View 1 Replies View Related

VS 2008 Linq 2 Entities Can't Add An Association

Mar 21, 2009

I'm a bit of a n0ob to all this and I'm having trouble finding good resources on the net.What I'm trying to do is define a one-to-many relationship between two entities. I'm using the GUI tool in Visual Studio - and have created the tables in Microsoft SQL Server Management Studio.Basically, I have two tables....a 'Users' table and a 'Sites' table. A single user can have many sites associated with it.Users has a primary key of 'UID' and the Sites table as a primary key of 'Site_ID'.Sites also has a column 'UID' that should indicate which user that site is associated with.Anyway - it sounded pretty simple; but no matter what I attempt to do, I can't seem to get it to work. Mostly, I get validation errors - sometimes run-time errors, or sometimes, no actual data even though there should sites that match the UID of the user.I am able to connect and write LINQ against my Users table/pull down User objects - but can't seem to get it to know that the Sites are associated with the user.In the GUI - if I go to 'Add Association' and create a 1 to many link between Accounts and Sites - and Validate - I get an error saying, "Error1Error 11008: Association 'AccountsSites' is not mapped."

It seems like, when I try to make an association, it wants to link the 'Keys' of each entity.But U_ID and SITE_ID are the keys and, obviously, shouldn't match.If I click on the line it created in the GUI and I go to 'Table Mapping' I can see that it is trying to match those keys. Since I want it to match user_ids my first thought is to just make the U_ID the entity Key in the Sites entity but, of course, that's wrong because it would no longer allow a 1 to many relationship.

View 1 Replies View Related

Communications :: Track Entities Id's From Client To Server?

Apr 17, 2012

Well first off let me say I am not sure if this should be in network or game programing but I think network programing is more relevant.


I am creating my first game that runs over a network and so far everything is working. I have a server program, the clients can connect and see each other flying around. (weeeee)

However I have hit a wall when trying to make them shoot. The most easy way I can think to do this, is to have the client tell the server �hay i need a bullet pointing at x angle moving at y speed� the server then spawns a bullet entity then sends a spawn entity packet to all the clients. The main problem I see with this, is that the clients gun will have a delay based on latency.(funValue -= 1000)

The only other way I can think to do this, is to have some fake bullets spawn on the client but when the client gets the spawn bullet packet from the server, I am not sure how to keep track of what fake bullets to delete.

View 1 Replies View Related

Linq To Entities Query With Child Objects?

Oct 13, 2011

Basically I have the follwing:Dim ctx As New AdminCoreEntities Dim roles = (From r In ctx.Roles where r.Name.StartsWith("cust") Select r) 'list of System .Linq.IQueryable(Of AdminCoreModel.Role)


The error i get when i run this is: Unable to cast object of type System.Data.Objects.ObjectQuery`1[AdminCoreModel.Role] to type AdminCoreModel.Role

Basically I have a many to many situation and I try to get all the Quicklinks objects queried by their roles and not quite sure why EF will cast to a single AdminCoreModel.Role when i.Roles is a collections of objects.

View 1 Replies View Related

Linq To Entities, Filter Using Where And A List Of Stings?

Nov 2, 2011

I am trying to write a query for an existing database, I am using LINQ on EF3.5 inside VS2008 as that is the only environment available to me.I have a starter query that gives me a list of items so the user can select what they want.

"e.Result =
From c In MLDb.TBL_FeatureInfoSet

The user can then select from the list one or several items they are intersted in and i want to use these as the filter in a further database call. It's not then difficult to have a where to filter on one string however, I would also like to be able to allow the user to select several items from the list box and the data for all of those to be returned.


View 2 Replies View Related

Update An Object's Foreign Key Value With LINQ To Entities

May 4, 2012

[code]How do I update the ProdServiceID in the database using LINQ to entities?

View 1 Replies View Related

Designing Software - Making A MPC Sampler - Drum Machine - Making A Sound Directory ?

May 16, 2012

I'm a huge music person (got my own lil record thing going) but I'm wanting to design a program that would make music in my way. I have a decent amount of background knowlege of Visual Basic and Java I'm just wondering how could I execute this whole project. The Project is making a MPC Sampler. MPC is a drum machine; a machine with buttons that once you press it that it will play a sound from a drum (ex: snare, kick, tom, ect.) . So I would want to make some pads on my program that each have their own sound. Total of 16 pads. Which the design wouldn't be hard to make nor would the functionality of it having the play back sound (in my opinoin it wouldn't be hard atleast). But the thing is I wanna map out these pads to number keys on the number pad or keyboard. I'm not so sure how to do that. But that's all the easy stuff...

Also finding information is making a sound directory. What I mean by this is that I want to make a User Interface that will open up a file directory of sounds and the user can select what "kick" or "snare" sound he may want for the kick or snare pad. I don't know how to do that or even know what to search; neverless I don't know if this whole project idea is a good idea for Visual Basic or another programing language.

Also LATER ON I am wanting to add a record and export function that alows users to..well...record and export their beat or instrumental ha. That doesn't seem too too complex (mainly due to the fact that all it needs to do is record the users key strokes and then show them and play the sounds, but obviously it would get more complex than that.)

Here is an image of one of many MPCs but one with a directory - [URL]

View 5 Replies View Related

.net - Detect Empty Results In A Linq-To-Entities Query?

May 29, 2009

The only way I know of is awkward:

'check for empty return
Dim count As Integer = (From s In myEntity.employee Where employeeID = myEmployeeIDVariable).Count
'If there is a record, then process


View 2 Replies View Related

.net - In Linq To Entities - How To Do An Inner EXISTS (SELECT 1 FROM - Type Of Query

Mar 6, 2011

I am trying to write a LINQ equivalent of

WHERE T1.C4='xyz' AND
WHERE T1.C17 = T2.C24)

I'm using EF CTP 5, so I have a DBContext variable named dbc, which includes DBSet objects T1s and T2s, based on POCOs T1 and T2.

In LINQ I write

DIM IND = From i In dbc.T1s
Where i.C4 = "xyz"
And (From t In dbc.T2s Where i.C17 = t.C24).Any
Select i.C1, i.C2, i.C3
Order By C3

Running the query I get the error message "Unable to create a constant value of type 'T2'. Only primitive types ('such as Int32, String, and Guid') are supported in this context." When I omit the inner expression (third line in the LINQ code), the query runs fine. I tried switching the orders of the inner comparison, to be t.C24 = i.C17, with no effect.

View 1 Replies View Related - LINQ To Entities Does Not Recognize The Method System.ObjectCompareObjectEqual

Mar 21, 2012

I had a code segment on an page in the code-behind file. I decided to move it into a public subroutine in a module (general_functions.vb). Once I did this, however, the code no longer works - it throws an error. On the original code-behind I replaced the original code with a call like so:


View 1 Replies View Related

Impliment A ISaveOrUpdateEventListener To Set The Datecreated And Dateupdated Fields On Entities

Aug 8, 2011

I'm just starting out a new project, and am trying to impliment a ISaveOrUpdateEventListener to set the datecreated and dateupdated fields on my entities.
I've been trying to follow a simplified version of the solution found here: [URL] Here's my listener:


View 1 Replies View Related

LINQ To Entities .Any() Results In Null Reference Exception?

Nov 16, 2011

I have a simple query as below:

Dim sizings = From a In db.Sizings
Where a.Customer.ID = customer.ID
Select a
If sizings.Any Then

The sizings.Any line is throwing a null reference exception. I thought I was meant to use .Any to determine if there were any rows returned?isnothing(sizings) returns false.

Edit - Resolution:Don't use null objects in the LINQ Query!

View 2 Replies View Related

OOP - Objects For Entities With Master Lists And Object Composition?

Feb 23, 2009

I'm trying to wrap my head about how to properly implement an OOP design for business objects that:

Have a "master list" in a database (ex. classifications)Are a part of another object as a property (i.e. object composition) but with additional properties

Here is where I'm stuck on the theory. Suppose that I have a Classification object, inheriting from the abstract class BusinessObject with the CRUD functions defined (MustOverride). This will give me:


What kind of other design could I implement here? It's obvous that I'm designing this the wrong way, but I don't see an easy alternative pattern. I don't want to repeat the code in the CustomerClassification class by not inheriting Classification and repeating all the field and property code, but I also don't want to expost CRUD functions to the CustomerClassification level. What am I missing in looking at the overall class design?

EDIT: Saving the classification level to the database will be handled by the customer object, because the database is legacy and the field for Level is defined in the customer table.

View 2 Replies View Related

Use Linq To Entities To Group A Collection Without Using Anonymous Types?

Apr 24, 2012

The documentation has an example about grouping on multiple properties[code]...

Is it possible to rewrite the original query to just return IEnumerable(Of CustomerRegionGroup), or do I have to use the anonymous type, and run a second query on the result of the first?

View 1 Replies View Related

VS 2010 Use LINQ To Entities To Populate List View

Jun 23, 2011

Here's what I tried, but I get an error at run time on the AddRange line that states "Only parameterless constructors and initializers are supported in LINQ to Entities."


View 5 Replies View Related