Hi to all,
I have xml file,that file(xml) convert to class file using .NET
Configuration Code Generator editor but now i add the class file in my
project but compile the project i get three error .
1.The type or namespace name 'AppSettingsElement' could not be found (are
you missing a using directive or an assembly reference?)
2.The type or namespace name 'StartupElement' could not be found (are you
missing a using directive or an assembly reference?)
3.The type or namespace name 'Aop' could not be found (are you missing a
using directive or an assembly reference?)
here i am using NetOffice Open source for .Net
but here i can,t read config file in the NetOffice Projects.
Now i am convert to app.config file convert to xml file using .NET
Configuration Code Generator editor
hear i am paste app.config file and class file
1.XML
--------------------
<?xml version="1.0" encoding="utf-8" ?>
<Family Name="The Does">
<Contact WebSite="[http://www.thedoes.com]"
Email="[[email protected]]" HomePhone="+91-80-12345678"/>
<Members>
<Add FirstName="John" LastName="Doe" Age="40">
<Contact Email="[email protected]" Phone="+91-9845012345"/>
</Add>
<Add FirstName="Jane" LastName="Doe" Age="39">
<Contact Email="[email protected]" Phone="+91-9845067890"/>
</Add>
<Add FirstName="Jack" LastName="Doe" Age="18" Minor="False">
<Contact Email="[email protected]" Phone="+91-9845054321"/>
</Add>
<Add FirstName="Jill" LastName="Doe" Age="15" Minor="True">
<Contact Email="[email protected]" Phone="+91-9845009876"/>
</Add>
</Members>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
<appSettings>
<add key="DateFormat" value="Hai h r"></add>
</appSettings>
</Family>
my App.config
---------------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
<appSettings>
<add key="DateFormat" value="Hai h r"></add>
</appSettings>
</configuration>
converted file in class Name AOP
-------------------------------------------------
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public sealed class Family {
private static FamilySection _config;
static Family() {
_config =
((FamilySection)(global::System.Configuration.ConfigurationManager.GetSection("Family")));
}
private Family() {
}
public static FamilySection Config {
get {
return _config;
}
}
}
public sealed partial class FamilySection :
System.Configuration.ConfigurationSection
{
[System.Configuration.ConfigurationPropertyAttribute("Name", IsRequired
= true)]
public string Name
{
get
{
return ((string)(this["Name"]));
}
set
{
this["Name"] = value;
}
}
[System.Configuration.ConfigurationPropertyAttribute("Contact")]
public ContactElement Contact
{
get
{
return ((ContactElement)(this["Contact"]));
}
}
[System.Configuration.ConfigurationPropertyAttribute("Members")]
[System.Configuration.ConfigurationCollectionAttribute(typeof(MembersElementCollection.AddElement),
AddItemName = "Add")]
public MembersElementCollection Members
{
get
{
return ((MembersElementCollection)(this["Members"]));
}
}
[System.Configuration.ConfigurationPropertyAttribute("startup")]
public StartupElement Startup
{
get
{
return ((StartupElement)(this["startup"]));
}
}
[System.Configuration.ConfigurationPropertyAttribute("appSettings")]
public AppSettingsElement AppSettings
{
get
{
return ((AppSettingsElement)(this["appSettings"]));
}
}
public sealed partial class ContactElement :
System.Configuration.ConfigurationElement
{
[System.Configuration.ConfigurationPropertyAttribute("WebSite",
IsRequired = false)]
public string WebSite
{
get
{
return ((string)(this["WebSite"]));
}
set
{
this["WebSite"] = value;
}
}
[System.Configuration.ConfigurationPropertyAttribute("Email",
IsRequired = false)]
public string Email
{
get
{
return ((string)(this["Email"]));
}
set
{
this["Email"] = value;
}
}
[System.Configuration.ConfigurationPropertyAttribute("HomePhone",
IsRequired = true)]
public string HomePhone
{
get
{
return ((string)(this["HomePhone"]));
}
set
{
this["HomePhone"] = value;
}
}
}
public sealed partial class MembersElementCollection :
System.Configuration.ConfigurationElementCollection
{
public AddElement this[int i]
{
get
{
return ((AddElement)(this.BaseGet(i)));
}
}
protected override System.Configuration.ConfigurationElement
CreateNewElement()
{
return new AddElement();
}
protected override object
GetElementKey(System.Configuration.ConfigurationElement element)
{
return ((AddElement)(element)).FirstName;
}
public sealed partial class AddElement :
System.Configuration.ConfigurationElement
{
[System.Configuration.ConfigurationPropertyAttribute("FirstName",
IsRequired = true)]
public string FirstName
{
get
{
return ((string)(this["FirstName"]));
}
}
}
}
}
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net