.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

How to get rid of entitysets in code that is generated using sqlmetal

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
 
hiI am using sqlmetal to generate code.below is the line i am using for code generation.SqlMetal.exe  /server:localhost /database:abc /code:..\Entities\CoreEntities.Generated.cs /namespace:abc.DAL /Context:abcDataContext /pluralizeIts working perfect but tables association are also generated , which I dont want in my code.Its generating code for table associations as well.[Association(Name="FK_Profile_LogonInfo1", Storage="_EXPRESS", ThisKey="EXPRESSEDTOUSERID", OtherKey="ID", IsForeignKey=true)]I feel that they are not required in front end, so I dont want sqlmetal to generate code for table associations.Please guide me.thanksSuman


View Complete Post


More Related Resource Links

SvcUtil-generated code or shared interface/data contract assembly?

  
If you control both service and client is there any benefit in using svcutil.exe to generate client proxies? Or is it better to share interface/data contract assembly between client and service?

Code behinds in MVC2 - How to inject auto-generated code into views via partial classes?

  
Background:I have written a t4 template that basically replaces the work done by StronglyTypedResourceBuilder to give design time access to string resources as properties of classes, one class per resource file.  Why?  Well I needed to add some customer code that handles string token substitution and a few other customizations.  Anyway, the template is working out really well and I may blog on it soon.In the mean time though, following a common pattern, I have one .resx file for each view, master page, controller, etc.  I would really like my t4 template to add a property to each such entity that gives quick access the custom resource class associated with it.  For controllers this is easy.  T4MVC is ensuring that they are a all declared partial.  All I need to do is create the appropriate partial class in my output that declares a readonly property that returns an instance of the appropriate generated resource class.The Problem:I would like to do the same thing, inject generated code, into my views.  Were this traditional ASP.Net, each .aspx page would have a .aspx.cs page and possibly an .aspx.designer.cs page that are all partial classes extending in the aspx page's class definition.  There is no such thing by default in MVC and for good reason.  However, I think for my purposes, if there is a way to do this, it

Issue with Proxy code when generated for WCF service

  

Hi,

There is an issue I am going through when generating Proxy code for my WCF services. Whenever I generate Proxy code for services with methods having VALUE Type parameters, additional BOOL parameter <parameter>Specified is added to the generate Proxy Code.

So if I have method - Employee GetEmployee(int Id), the respective proxy code for this method will be - Employee GetEmployee(int Id, bool IdSpecified).

Moreover, if you do not set this bool parameter value to TRUE, no value will be passed to the End service.

I can understand this can come handy when handling Null inputs, but that will not be always the case.

After doing some R&D, I found that if I add Data Format attribute of type RPC to my Method contract, these parameters are removed. Like if I add: 

[DataContractFormat(Style = OperationFormatStyle.Rpc)] , the generated proxy code reflects all value type parameters as is.

I am not an expert in WCF, and for the same reason I don't have much idea on what significance this attribute plays for the service methods. Can adding this attribute introduce problems when consuming these methods by application in .NET 1.1 or in JAVA?

 

Can anyone help me in getting ride of this additional parameter in the proxy?

Thanks in Advance.

 

Thanks,

Amit


Reference to a non-shared member requires an object reference in code generated by ASP.NET

  

Hi,

I am working on converting a project from C# to VB and am facing this weird issue. 1 page cannot compile and I get the reference error, but the weird thing is that the compiler shows the error as coming from ASP.NET generated code. Visual Studio shows me that error is coming from my ASPX page. I cannot seem to figure out why or where this error is occuring. Also if I take the inherits attribute out I don't get the compilation error. The code in aspx page is below:

<%@ Page Language="VB" AutoEventWireup="true" CodeBehind="diff.view.aspx.vb"  Inherits="MR.ControlApp.diffview" MasterPageFile="~/Site1.Master"%>

<asp:Content ID="Header1" ContentPlaceHolderID="head" runat="server">

<form>
    Page: <select onchange="sel(this);">
    <%
        Dim j As Integer = 0
        While j < pageCount
    %>
           <option <%= IIf(currentPage = ( j + 1 ), "selected", "")  %> value="<%= j+1 %>"><%= j + 1 %></option>
        <%j = j + 1
        End While
    %>
    </select>
    </form>
    <% 'Print(); %>
    <div style="font-family: verdana; font-size: 10pt; font-weight: bold">
        MDM Data Inconsiste

Is the executable file generated by compiler a Managed code or Unmanaged code ?

  

Hi,

when we compile our vb.net or c#.net code (say in a simple console application) then in bin\Debug folder a .exe file is created.Is that a managed code? when i directly execute this file,will this target CLR ? or will it directly run on OS ?

Why there is ConsoleApplication1.vshost.exe.manifest files created in that folder ?

What is .pdb file ?

That executable file is also created in obj\Debug folder .Why ?


VS2010 - Problem with WinForms generated code

  

Hi:

I'm having trouble with the code that is generated automatically by the WinForms designer, sometimes it generates code that uses the 'components' (IContainer) in the constructors of disposable components and other times it doesn't.

Here is some code. First the code that is generated in a clean new project with just one component on the form:

  private void InitializeComponent()
  {
   this.components = new System.ComponentModel.Container();
   this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
   ((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit();
   this.SuspendLayout();
   // 
   // errorProvider1
   // 
   this.errorProvider1.ContainerControl = this;
   // 
   // Form1
   // 

Namespace Issue in Generated Code

  

I have a Solution in which I have A WCF Service web site project which then hosts two separate WCF Service Libraries (each in their own project).  One of the Web Services is a Client to the other. 

When I click the ClientService and select Add Service Reference, it all adds properly, but when I go to build it, I get this error in the reference.cs (the generated file).

The type name 'HostWCFService' does not exist in the type 'ClientService.ClientService' C:\Users\...\Reference.cs 

I don't want it to create a ClientService.HostWCFService namespace, I want to be able to use the HostWCFService as its own namespace.  I believe I've had this setup working before at one point; that is, I had this arrangement working before, but am not sure now if the host service was in a sub namespace of the project.

I was able to do: 

using HostWCFService;

instead of

using ClientService.HostWCFService;

Any thoughts? 
 


Compiler error in a generated code file?

  

So one of my views refuses to display, instead throwing up an error about an unreferenced assembly in a generated code file.

Here's the controller action:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using CindySanabria.Domain;
using System.Diagnostics;

namespace CindySanabria.Controllers
{
    public class ProfileController : Controller
    {
        private IMembersRepository _membersRepo;

        public ProfileController(IMembersRepository repo)
        {
            Debug.WriteLine("Constructing ProfileController");
            this._membersRepo = repo;
        }

        //
        // GET: /Profile/Create
        [Authorize]
        public ActionResult Create()
        {
            Debug.WriteLine("Running Create action");
            return View();
        }
    }
}

And here's the view:

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CindySanabria.Domain.Member>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Create Profile
</asp:Content>

<asp:Content ID="Content2" ContentPla

My auto-generated code gives errors, can somebody see why???

  

I have a windowsservice and this windowsservice calls a webservice.
When I update this webservice, visual studio create a reference.cs.
The problem with this reference.cs is that is gives me more then 100 error
messages.
The error messages are all the same:
The type name 'AckService' does not exist in the type 'MyNewService.MyNewService' C:\MyNewService\Service References\AckService\Reference.cs 

Can somebody see why?

This is the code:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3053
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace MyNewService.AckService {
    
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(Namespace="http://npq/AddIncident", ConfigurationName="AckService.ServiceSoap")]
    public interface ServiceSoap {
        
        // CODEGEN: Generating message contract since element name xmlString from namespace http://npq/Ad

In Visual Studio how do I view XSD code generated from xsd.exe?

  

I have an XML file that I've created.

Now I use xsd.exe to create the corresponding XSD.

I open the XSD in Visual Studio - it shows me the design view.

I right click on the design surface and select View Code, but nothing happens.

How can I view the code in Visual Studio?

If I open the XSD file in notepad I can see the code just fine.


VS2008 and Anonymous code generated!!!!!!!!!!!!!!

  

My GOD!! why there is no easy option in VS to disable this feature. I waste SO MUCYH programming time. its crazy. it was working nicely before and now i cant remember what happend my asp.net project takes so much time to debug because of all anonymous code that is been generated..

 please help me disable this hell feature!!!

ty


the code for writing a image from the pixels generated...

  

dear sir/madam,

    i have written a code in asp.net to read an image from file uploader,,from this image i have extracted RGB values(for each pixel)...now i have to write a image using this RGB values itself ,so that the image will be same as image i have read...i have writurn the code but i am not getting the image..please help me in writing this image..please

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Image1.Visible = false;
            Image2.Visible = false;
           
            Label1.Visible = false;
            Label2.Visible = false;
          
        }

    }
    protected void Button1_Click(object sender, EventArgs e)  //to read imag e and extract RGB
    {

        Image1.Visible = true;
      

        ListBox1.Items.Clear();
      
        String filename = null;
        string path = null;
        if (FileUpload1.HasFile)
        {
            filename = FileUpload1.FileName.ToString();
            path = "~/image/" + filename;
            FileUpload1.PostedFile.SaveAs(Server.MapPath(path));

        }
        String[] getExt = filename.Split('.');
        Label2.Text = getExt[1];
        Image1.ImageUrl = "~/image/" + filename;

        System.Drawing.Image imgs = System.Drawing.Image.FromFile(

Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

  
When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Free Code Snippets - ASP.NET

  
You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

  
Free C# Code Snippets

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend