|
Jeremy --
Regarding this...
>>>why do you want to know?
...I want to know because I want to correct the solution if necessary, and to make the solution better if possible, and to communicate the solution to others using the common terminology, and etc.
Regarding this...
>>>What value will you receive in mapping patterns to your existing solution?
...the value will be that the solution may be easier to understand, and the solution will be more documented given that it follows a pattern that has already been already well-documented, and the solution will be more fully tested given that it follows a pattern that has already been well-tested, and etc.
Thank you.
-- Mark Kamoski
|
|
|
|
|
Great points!
Based on what I read, it sounds like the closest pattern is really Repository. Your "EntityManagers" seem to fit the bill quite nicely.
|
|
|
|
|
As per Fowler, your entity classes will be Data transfer objects[^].
Mark Kamoski wrote: Multiple Entity objects are collected in various says, such as a typed-collection, an array of objects, an EntitySet, or similar.
Each entity object is a different type. How can you make a single typed collection which are different types? Other than this, your design looks just good. I haven't read Fowlers EAA book and can't comment on the patterns you have provided. But the UML diagrams of those patterns shows, you have got the patterns correctly.
|
|
|
|
|
Navaneeth --
Regarding this...
>>>Each entity object is a different type. How can you make a single typed collection which are different types?
...that was actually pretty simple. At the implementation level, everything comes back as "IQueryable" and the underlying EntitySet is of the particular type needed. The call-site casts, which is not too much of a burden-- the caller must know what its asking for in a return or must live with a generic IQueryable object. It actually works quite well. Etc. Everything is pretty simple, as follows.
This is the interface that is implemented by each EntityManager...
<br />
...<br />
public interface IL2sEntityManager<br />
...<br />
IQueryable Retrieve();<br />
...<br />
This is a sample of what an EntityManager looks like...
This is the code being called...
<br />
...<br />
public partial class CategoryCodeManager : Team.Framework.Interfaces.BusinessLayer.BusinessEntities.IL2sEntityManager<br />
...<br />
public IQueryable Retrieve()<br />
...<br />
This is a sample call-site...
<br />
...<br />
protected void DataBindTest1()<br />
{<br />
BusinessLayer.BusinessManagers.CategoryCodeManager myManager = new BusinessLayer.BusinessManagers.CategoryCodeManager();<br />
<br />
IQueryable<BusinessLayer.BusinessEntities.CategoryCode> myEntitySet = (IQueryable<BusinessLayer.BusinessEntities.CategoryCode>)myManager.Retrieve();<br />
<br />
this.EntitySetGridView.DataSource = myEntitySet;<br />
<br />
this.EntitySetGridView.DataBind();<br />
}<br />
Etc.
I hope that answers your question.
Thank you.
-- Mark Kamoski
|
|
|
|
|
All --
If you are interested in a code sample, go to this link...
http://linq2sqleb.codeplex.com/SourceControl/PatchList.aspx[^]
...one can and you will file the file "Northwind01_T4Sample_200908141146.zip" is a fully-implemented, working, code sample (with PresentationLayer and BusinessLayer and etc) that shows one way to use T4 ToolBox to generate code from a database, using Linq-To-Sql-Entity-Base, the Repository design pattern (maybe), and a few other goodies.
HTH.
Thank you.
-- Mark Kamoski
|
|
|
|
|
I moved a site onto a 2008 box after having it on a 2003 server box and did some testing only to find that the redirection on an error failed to go to the error.aspx page I had. I've been googling this for quite some time to no solution.
I looked for an IIS forum, but couldn't find one. I think the solution is in IIS, but I'm not sure.
Any help would be much appreciated.
|
|
|
|
|
wolfbinary wrote: redirection on an error failed to go to the error.aspx page
So, you are redirecting on Error Page from global.asax ? Can you show us the code for Application_Error Secction ?
I guess you are using Response.Redirect From Application_Error .
This is the Problem related with IIS 7 and Its integration mode. Which mode you are using ? Integrated or Classic ?
if Its Integrated mode and change to classic it may work.
Here[^] I found a good solution [ The summary as below ]
Analysis :
The problem is caused by changed behavior of IIS7 new integrated pipeline mode when calling Response.Redirect() in Application_Error. The default .net error page will be rendered before the actual redirection occurs due to error is detected.
Solution
1. Remove the module definition of ScriptModule under system.webServer/modules in web.config. e.g:
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Remove Application_PreSendRequestHeader and Application_PreSendRequestContent event handlers from global.asax if they are not used.
2.Call Context.ClearError or Server.ClearError to clear the error before using Response.Redirect() in Application_Error .
Hope this will help you
|
|
|
|
|
I tried your above solution and you don't have to remove the config file part to get it to work. If you just clear the error and to the redirect all it well.
Thanks for the response though. It got me going in the right direction.
|
|
|
|
|
Hi..
I am using asp.net/c#.
I have used the following code for reading word document. But it reads only text data and not displaying the images in the word document.
string docname = dr["docname"].ToString();
string path= Server.MapPath("festival_doc");
string m = path + "//"+docname;
Word.ApplicationClass wordapp = new Word.ApplicationClass();
object file = m;
object nullobj = System.Reflection.Missing.Value;
Word.Document doc1 = wordapp.Documents.Open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
TextBox1.Text = doc1.Content.Text;
doc1.Close(ref nullobj, ref nullobj, ref nullobj);
Can anyone solve the problem?
|
|
|
|
|
TextBox1.Text = doc1.Content.Text;
The above line is why it only reads text, it is all you're asking it to. Also, the text box you're assigning to can only handle text so if you try and set the value to any other property it probably won't compile.
|
|
|
|
|
Thanks for answering!
But I need to read all the data in the word document including images and display it in web page.
Please give me the solution.
|
|
|
|
|
lagan wrote: But it reads only text data and not displaying the images in the word document.
Are you assigning the data into textbox? How can you expect a textbox to display images?
|
|
|
|
|
I have one page where I am allowing user to upload .xls file. I am storing these files on server in a folder. I have added <identity impersonate="true"> line in web.config.
After doing this above still its giving me following exception when I try to upload .xls file on the server.
|
|
|
|
|
Have you given read/write access to asp.net user on the folder where you are uploading files?
|
|
|
|
|
Hi ... sorry for distrubing u all again and again...
please suggest me any alternate method for the placeholder .
i am getting postback issue in usercontrol.. i should not use query string aswell..
Plz help me
Ramkumar
|
|
|
|
|
Your question makes no sense. If yuo get an error, tell us what it is. Post some code. Tell us what you're trying to do. This is useless. We cannot help you.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi everybody.
Does anybody even IMAGINE why writing this in a RegisterStartupScript block would cause my textbox to lose its value upon postback???
Page.ClientScript.RegisterStartupScript(GetType(),"document.getElementById('" + txtp.ClientID + "').value; "...... etc
txtp.Text = "-1";
Let me say that one more time. I am reffering to the ClientID of "txtp" in a RegisterStartupScript. I merely take the value from it, that's all. And when the page retuns, txtp always has its default value, the one I populate in it, see the next line, when I set -1. But if I comment out that line with the .ClientID, then when the pages posts back, after I repopulate, even if I set -1 to the textbox, I DO GET THE CORRECT number in it, which was entered client-side, before the user presses the submit button.
With .Client ID line uncommented:
1. Load dynamic user control in which txtp is.
2. Set -1, register startup script
3. User writes 2 in the textbox
4. Submit
5. Value in textbox is -1.
WRONG
With .Client ID line commented:
1. Load dynamic user control in which txtp is.
2. Set -1, register startup script
3. User writes 2 in the textbox
4. Submit
5. Value in textbox is 2.
CORRECT
Somebody please help me out here....... I'm way over my head, I don't understand a bit of what is happening, even though I have studied the lifetime of the page and I am loading the control dinamically at the master's page Init.
But even if I messed something up in the lifetime, THIS STILL DOESN'T explain why a silly .Client ID messes everything up! Weird!
|
|
|
|
|
Are you sure of this.
I did this myself
this.ClientScript.RegisterStartupScript(typeof(Page),"scriptblock", "<script>var x = document.getElementById('" + txtp.ClientID + "').value; </script>");
txtp.Text = "-1";
and found 2 on txtp.Text when form is posted back.
I think the problem is every time you post back the form it resets the txtp.Text to -1 as you wrote this in Page_Load event I think.
So please write
If(IsPostBack)return; at the beginning, I think it will work properly..
|
|
|
|
|
Hi and thanks for answering Abhishek! No, this is not an IsPostBack problem. I'm not a beginner. Simply uncommenting that line will make the value reach the server again! That's the weird thing. And it works for you perhaps because you don't have that textbox in a dinamically created User Control. What I'm wondering is WHY EXACTLY uncommenting that sh*tty line makes everything work! I can't believe it!
|
|
|
|
|
Ya.. Is it so.. This is really weird. Love to see the exact scenario. If possible can you share the code with me. We can also place a bug report to Microsoft about that if it really happens...
|
|
|
|
|
hi all,
how to i send xml file to client side and than how to use this xml in javascript?
thanks
|
|
|
|
|
I couldnt get you properly. You need to send an XML, just write that in the Response.
You can use a http handler to get the XML from the server. Just call using AJAX.
You can get the elements of the XML using DomParser.
Check this one
http://www.w3schools.com/Xml/xml_parser.asp
for xml parsing.
|
|
|
|
|
I have a web app with some restricted aspx pages and my security check is being done by the master page of the aspx pages. (not sure if this is a great idea).
my problem is if there is no logged in user or he does have the required rights, i forward to a No-Rights error page.
I want to specify this page relative from web-app root. This is important to have portable code (locally pages are at localhost/Project-Name/Restricted/etc..., while on server they are at host/Restricted/etc...)
Someone suggested the ~ option, but this does not work in code behind - it only works in aspx pages. My security checks, of course, are done in the code behind.
any help?
|
|
|
|
|
|
For the full path use Page.ResolveUrl() , for a relative path (relative to the user's browser) use Page.ResolveClientUrl . Both will take in the ~ format and map it to a real path. If you are in a control, the methods are available from Control as well (Page is a type of Control).
|
|
|
|