You can create a stored procedure, and then add that to your EDMX (model) to be called. Just right click and select "Update model from database", there should be a stored procedures tab. See also here Find the stored procedure in the Model Browser Right-click it and select Create Function Import Choose what type of entities are returned.(in this case: NodePath) Call the function from within your code: Dim ActivePaths = context.
ActivePaths(GivenNode. Id) If you wanted to do this without a stored procedure, you'd have to use LINQ or Entity SQL. Or ADO.NET of course :).
You can create a stored procedure, and then add that to your EDMX (model) to be called. Just right click and select "Update model from database", there should be a stored procedures tab. See also here.
Find the stored procedure in the Model Browser. Right-click it and select Create Function Import. Choose what type of entities are returned.(in this case: NodePath) Call the function from within your code: Dim ActivePaths = context.
ActivePaths(GivenNode. Id) If you wanted to do this without a stored procedure, you'd have to use LINQ or Entity SQL. Or ADO.NET of course :).
I've updated this answer with more steps. Thank you, Marcel. – Zack Peterson Aug 7 '09 at 15:50.
I believe I've translated that SQL correctly, but I can make changes if necessary. This is selecting one NodePath for each common Path (based on the greatest Created), so long as it matches the NodeId. C# Solution: var nodePaths = (from p in context.
NodePaths group p by p. Path into g select g. OrderByDescending(i => i.
Created).First() ). Where(p => p. NodeId == givenNodeId); VB.NET Solution (I think, not my primary language): Dim nodePaths = (From p In context.
NodePaths _ Group p By p. Path Into Group _ Select Group. OrderByDescending(Function(i) i.
Created).First() _ ). Where(Function(p) p. NodeId = givenNodeId).
This is a little odd though, as it grabs the NodePath with the greatest Created first, then filters. This appears to be how the SQL query works though, which is why I wrote it like this. – Ryan Versaw Aug 6 '09 at 22:54 Also, I wrote this with LinqToSql in mind, but I'm not seeing anything that would cause issues in the Entity Framework.
– Ryan Versaw Aug 6 '09 at 23:02 Thank you, Ryan. I've decided to go with Marcel's stored procedure suggestion for now. I know I must eventually force myself to get far more comfortable with LINQ.
– Zack Peterson Aug 7 '09 at 15:51 Sure! Even if you don't feel comfortable having queries like this in your code, it might be interesting to run it (either normally, or with LinqPad) just to see what query it generates compared to your current one. – Ryan Versaw Aug 7 '09 at 17:01.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.