|
I picked up a book on Entity Framework. So far it seems very similar to Linq to SQL. Am I missing something? Is there a compelling reason to use EF over Linq to SQL?
If it's not broken, fix it until it is
|
|
|
|
|
LINQ to SQL was good for one to one mapping.
Entity Framework is good for mapping against multiple tables.
Entity Framework vs LINQ to SQL[^] is a good blog read.
|
|
|
|
|
EF is a full entity mapping framework, like NHibernate – it links a database model (with many tables, relationships etc) and a memory model (with many classes, links etc). It is a level of abstraction above direct access technologies like Linq.
You should use it if you want a mostly transparent mapping between database and in-memory code objects. You shouldn't if you prefer to have direct control over when you interact with the database and how. It can also be a bit of a pain setting up EF on an existing database if that database doesn't fit what you want as data objects exactly.
|
|
|
|
|
Hi,
MCTS Self-Paced Training Kit (Exam 70-516): Accessing Data with Microsoft .NET Framework 4 ebook is very useful to learn about EntityFramework specially chapter 6.
hope you like this book
Thanks
-Amit
|
|
|
|
|
Hi,
Everything I've googled says this should work, but I get "invalid namespace" and was wondering if someone can help me get a baseline going so that I can build off of that?
I have the necessary references/includes, I just cannot get this to work for the life of me. Thanks for reading.
string cServername = "[server]";
System.Management.ConnectionOptions objconn = new System.Management.ConnectionOptions();
objconn.Impersonation = System.Management.ImpersonationLevel.Impersonate;
objconn.EnablePrivileges = true;
objconn.Username = "[user]";
objconn.Password = "[pass]";
objconn.Authority = "ntlmdomain:[domain]";
System.Management.ManagementScope exmangescope = new System.Management.ManagementScope(@"\\" + cServername + @"\root\MicrosoftExchangeV2", objconn);
System.Management.ObjectQuery objquery = new System.Management.ObjectQuery("SELECT * FROM Exchange_Mailbox");
System.Management.ManagementObjectSearcher objsearch = new System.Management.ManagementObjectSearcher(exmangescope, objquery);
System.Management.ManagementObjectCollection queryCollection1 = objsearch.Get();
string strDisplay;
foreach (System.Management.ManagementObject instmailbox in queryCollection1)
{
strDisplay = instmailbox["MailboxDisplayName"].ToString() + " " + instmailbox["size"].ToString();
System.Console.WriteLine(strDisplay);
}
|
|
|
|
|
It's simple, really. The namespace you're specifing doesn't exist on the target machine.
Use this[^] to show you what namespaces are on the target machine.
|
|
|
|
|
Thanks for that Dave, here is the output:
PS C:\Users\> gwmi -namespace "root" -class "__Namespace" | Select Name
Name
----
subscription
DEFAULT
QuestSoftware
MicrosoftDfs
CIMV2
Cli
Nap
MicrosoftIISv2
MicrosoftActiveDirectory
SECURITY
SmsDm
snmp
RSOP
ccm
WMI
IntelNCS2
directory
Policy
Hardware
ServiceModel
Microsoft
aspnet
I guess Exchange doesn't have database entries? If that turns out to be the case, what is the next best way to get individual user mailbox statistics?
|
|
|
|
|
That depends on the version of Exchange you're talking about.
|
|
|
|
|
Good point , 2007 sp3
|
|
|
|
|
|
|
Does your Excahnge implementation have EWS 2007 installed? If not, this isn't going to work at all.
|
|
|
|
|
Hi Dave,
Yes, I am able to enumerate the folder names now and get the item count for each folder, but I cannot figure out how to convert the folder names to an item list to try and load the extended properties for each folder name.
|
|
|
|
|
Update:
I'm able to get it working, but only for my own mailbox? Any ideas? I can get it to attempt other users, but I get a permissions error. I'm an exchange org admin and full admin so I'm not sure why that would be?
private static readonly ExtendedPropertyDefinition PidTagMessageSizeExtended
= new ExtendedPropertyDefinition(0xe08, MapiPropertyType.Long);
private void button1_Click(object sender, EventArgs e)
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = new WebCredentials("[account]", "[password]", "[domain]");
service.AutodiscoverUrl("emailaddress@domain.com");
int moffset = 0;
int mPageSize = 500;
FolderView view = new FolderView(mPageSize, moffset, OffsetBasePoint.Beginning);
view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
view.PropertySet.Add(FolderSchema.DisplayName);
view.PropertySet.Add(FolderSchema.ChildFolderCount);
view.PropertySet.Add(FolderSchema.TotalCount);
view.PropertySet.Add(FolderSchema.UnreadCount);
view.Traversal = FolderTraversal.Deep;
FindFoldersResults folders = service.FindFolders(WellKnownFolderName.MsgFolderRoot, view);
var offset = 0;
const int pagesize = 500;
long size = 0;
FindFoldersResults foldersNew;
do
{
foldersNew = service.FindFolders(WellKnownFolderName.MsgFolderRoot,
new FolderView(pagesize, offset, OffsetBasePoint.Beginning)
{
Traversal = FolderTraversal.Deep,
PropertySet =
new PropertySet(BasePropertySet.IdOnly, PidTagMessageSizeExtended,
FolderSchema.DisplayName)
});
foreach (var folderNew in foldersNew)
{
object folderSize;
if (folderNew.TryGetProperty(PidTagMessageSizeExtended, out folderSize))
{
int bytes = Convert.ToInt32(folderSize);
int megaBytes = (bytes / 1048576);
size += megaBytes;
MessageBox.Show(folderNew.DisplayName + ": " + megaBytes + ", total mailbox size: " + size);
}
}
offset += pagesize;
} while (folders.MoreAvailable);
}
modified 30-May-12 16:54pm.
|
|
|
|
|
It appears it is because my CAS box doesn't have impersonation rights ... can anyone confirm this?
|
|
|
|
|
I'm no Exchange expert so I couldn't tell you. I also don't have an installation I can test any code against.
|
|
|
|
|
Hi,
I am having problem with the validation summary. I have radiobuttons where I kept requiredFieldValidation and all these are inside the gridview like shown below:
<asp:panel id="pnlEval" runat="server" enabled="false">
* Denotes required entry
<asp:validationsummary id="ValidationSummary" runat="server" forecolor="" headertext="<p class="valSummaryHeader">Please correct the following:</p>">
<div class="questionHeader">
<asp:label id="lblQHeader" runat="server" text="Questions" cssclass="question">
<asp:label id="lblAns1" runat="server" cssclass="answer">
<asp:label id="lblAns2" runat="server" cssclass="answer">
<asp:label id="lblAns3" runat="server" cssclass="answer">
<asp:label id="lblAns4" runat="server" cssclass="answer">
<asp:label id="lblAns5" runat="server" cssclass="answer">
</div>
<div class="questionDetails">
<asp:label id="lblQues1" runat="server" cssclass="question">
<asp:requiredfieldvalidator id="rfvQuest1" runat="server" controltovalidate="radAns1"
="" errormessage="All the questions must be answered" cssclass="valError" display="Static" forecolor="">!
<asp:radiobuttonlist id="radAns1" repeatdirection="Horizontal" runat="server" cssclass="answerGroup">
<asp:listitem value="1" text="">
<asp:listitem value="2" text="">
<asp:listitem value="3" text="">
<asp:listitem value="4" text="">
<asp:listitem value="5" text="">
</div>
<div class="questionDetails">
<asp:label id="lblQues2" runat="server" cssclass="question">
<asp:requiredfieldvalidator id="rfvQuest2" runat="server" controltovalidate="radAns2"
="" errormessage="All the questions must be answered" cssclass="valError" display="Dynamic" forecolor="">!
<asp:radiobuttonlist id="radAns2" repeatdirection="Horizontal" runat="server" cssclass="answerGroup">
<asp:listitem value="1" text="">
<asp:listitem value="2" text="">
<asp:listitem value="3" text="">
<asp:listitem value="4" text="">
<asp:listitem value="5" text="">
</div>
<div>
<asp:label id="lblQues3" runat="server" cssclass="question">
<asp:requiredfieldvalidator id="rfvQuest3" runat="server" controltovalidate="radAns3"
="" errormessage="All the questions must be answered" cssclass="valError" display="Dynamic" forecolor="">!
<asp:radiobuttonlist id="radAns3" repeatdirection="Horizontal" runat="server" cssclass="answerGroup">
<asp:listitem value="1" text="">
<asp:listitem value="2" text="">
<asp:listitem value="3" text="">
<asp:listitem value="4" text="">
<asp:listitem value="5" text="">
</div>
<div>
<asp:label id="lblQues4" runat="server" cssclass="question">
<asp:requiredfieldvalidator id="rfvQuest4" runat="server" controltovalidate="radAns4"
="" errormessage="All the questions must be answered" cssclass="valError" display="Dynamic" forecolor="">!
<asp:radiobuttonlist id="radAns4" repeatdirection="Horizontal" runat="server" cssclass="answerGroup">
<asp:listitem value="1" text="">
<asp:listitem value="2" text="">
<asp:listitem value="3" text="">
<asp:listitem value="4" text="">
<asp:listitem value="5" text="">
</div>
<div>
<asp:label id="lblQues5" runat="server" cssclass="question">
<asp:requiredfieldvalidator id="rfvQuest5" runat="server" controltovalidate="radAns5"
="" errormessage="All the questions must be answered" cssclass="valError" display="Dynamic" forecolor="">!
<asp:radiobuttonlist id="radAns5" repeatdirection="Horizontal" runat="server" cssclass="answerGroup">
<asp:listitem value="1" text="">
<asp:listitem value="2" text="">
<asp:listitem value="3" text="">
<asp:listitem value="4" text="">
<asp:listitem value="5" text="">
</div>
<div>
<asp:label id="lblQues6" runat="server" cssclass="question">
<asp:requiredfieldvalidator id="rfvQuest6" runat="server" controltovalidate="radAns6"
="" errormessage="All the questions must be answered" cssclass="valError" display="Dynamic" forecolor="">!
<asp:radiobuttonlist id="radAns6" repeatdirection="Horizontal" runat="server" cssclass="answerGroup">
<asp:listitem value="1" text="">
<asp:listitem value="2" text="">
<asp:listitem value="3" text="">
<asp:listitem value="4" text="">
<asp:listitem value="5" text="">
</div>
<asp:button id="btnSubmit" runat="server" text="Submit" onclick="btnSubmit_Click">
And now when i run the program, even before i click the submit button, the validation summary is showing. I want this summary to show only after I click the submit button and if there is any radio button unchecked.
Can anyone tell me where I have done mistake?
<div class="signature">suchita</div>
|
|
|
|
|
I don't know ASP, so can't comment. Though, apart from accidentally wrapping the last part of your question in the pre tags, there is one thing that's perhaps (hopefully) a mistake.
You might notice that this is a C# forum. Clearly your code is ASP.
Perhaps you'd get a better response if you posted it here[^]
|
|
|
|
|
|
Couldn't you just set the caption to "PINview +"?
/ravi
|
|
|
|
|
I have an icon that I want to use
|
|
|
|
|
|
There's an article on CodeProject[^] how to draw in the title bar of a form.
Bastard Programmer from Hell
|
|
|
|
|
|
You're welcome
|
|
|
|