简体   繁体   English

从C#原型到ASP.NET,我需要更改什么?

[英]from C# prototype to ASP.NET, what do i need to change?

I miss this place. 我想念这个地方。

Here are snippits i wrote in C#. 这是我用C#编写的代码片段。 I would like to know if i can copy/pasting this to a asp.net app and what i may need to change. 我想知道是否可以将其复制/粘贴到asp.net应用程序,以及可能需要更改的内容。 I am mostly worried that the syntax will be invalid because a compatible library doesn't exist. 我主要担心语法无效,因为不存在兼容的库。

struct MediaIdUserIdPair //is there a standard pair i can use?
{
    public long mediaId, userId;
};

class Media : Media_Base
{
    public long mediaId, auth;
    public DateTime currentDate;
    public List<MediaIdUserIdPair> derivedFrom, inspiredBy;
    public List<string> derivedFromStr, inspiredByStr;
    public List<string> inspiredByExt = new List<string>();
};

            command.CommandText =
                "CREATE TABLE if not exists tag_name( " +
                "tagid INTEGER PRIMARY KEY, " +
                "title TEXT UNIQUE);";
            command.ExecuteNonQuery();
                command.CommandText = 
                    "INSERT OR FAIL INTO tag_name(title) VALUES(@title); " +
                    "SELECT last_insert_rowid() AS RecordID;";
                command.Parameters.Add("@title", DbType.String).Value = tag;
                long tagid = (long)command.ExecuteScalar();

I don't see anything in the code samples that would need to change. 我没有在代码示例中看到任何需要更改的内容。

Basically, as long as your asp.net app targets the same version of the framework as your c# app, you should be good to go. 基本上,只要您的asp.net应用程序定位到与c#应用程序相同的框架版本,您就应该一切顺利。

Which part are you concerned about? 您关心哪一部分? It looks like standard C# to me; 对我来说,它看起来像标准的C#。 there's no reason it wouldn't work in whatever application type you want, as long as you reference the relevant libraries. 只要引用了相关的库,就没有理由在任何应用程序类型中都不起作用。 (System.Data, etc.) (System.Data等)

Your partial snippet doesn't contain any non-ASP.NET compatible code. 您的部分代码段不包含任何与ASP.NET不兼容的代码。 You can use any custom objects and ADO.NET from within either ASP.NET, WinForms and WPF. 您可以在ASP.NET,WinForms和WPF中使用任何自定义对象和ADO.NET。 As they are all libraries that run on top of the .NET Framework and the CLR. 因为它们都是在.NET Framework和CLR之上运行的库。

You may want to pick up one of the many good books on ASP.NET and/or C# that are available. 您可能要选择许多可用的ASP.NET和/或C#优秀书籍之一。 It sounds like you are fairly new to .NET and there are plenty of things that are worth learning. 听起来您是.NET的新手,还有很多值得学习的东西。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Visual Studio 2013上发布用c#asp.net创建的网站,我需要做什么? - What do I need to do to publish a website made in c# asp.net on Visual Studio 2013? 在ASP.NET(C#)中创建动态RSS提要页面 - 我是否需要做额外的事情? - Creating dynamic RSS feed page in ASP.NET (C#) - do I need to do anything extra? 如何根据从下拉列表中选择的内容(ASP.NET中的C#)更改标签的输出 - How can I change the output of a label, based on what's selected from a dropdown list (C# in ASP.NET) 我需要分开业务对象和业务逻辑吗? C#中具有存储库模式的Asp.net MVC - Do I need to Separate Business Objects and Business Logic? Asp.net MVC with Repository Pattern in C# 当我检查复选框时,如何更改特定的行样式? C#ASP.NET - When i Check the Checkbox how do I change that specific row style? C# ASP.NET asp.net c# 我需要从存储在另一个字符串中的变量名访问变量的值 - asp.net c# I need to access value of a variable from the variable name stored in another string 如何从C#ASP.NET网页调用非托管C / C ++代码 - How do I call unmanaged C/C++ code from a C# ASP.NET webpage C# asp.net 中有哪些选项可以在网站上绘制图表? - What options do I have available in C# asp.net to draw charts on websites? ASP.net C#,我怎么知道使用什么? - ASP.net c#, how do I know what to use? 在C#/ ASP.NET中,此配置错误是什么,我该如何处理? - In C#/ASP.NET What is this config error and how do I deal with it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM