Tag Archives: c#

Error handling when ABP specifies map object during map operation

Error handling in map operation of ABP

When mapping an entity object into dto in ABP, the entity defines an object of type long. In dto, there is an object with the same name, but the type is guid,

// StudentEntity
public class StudentEntity
{
		public Guid RelatedStudentId
		{
				get; set;
		}
}

// StudentDto
public class StudentDto
{
		public Guid StudentId
		{
				get;  set;
		}
		
		public Long RelatedStudentId
		{
				get; set;
		}
}

Take studententity and studentdto for example. Due to the change of business, when the back-end modifies the database and does not change the front-end code for the time being,

Directly map the relatedpatientid in entity to the studentID in dto , In this way, an error will occur when mapping, indicating that the type conversion error is wrong, and the data of the guid cannot be assigned to long,

CreateMap<StudentEntity, StudentDto>()
            .ForMember(d => d.StudentId, map => map.MapFrom(o => o.RelatedStudentId))

At this time, the entity’s guid type relatedpatientid will be mapped to the long type relatedpatientid in dto,

This kind of data definition should be avoided in map operation.

“XXXXXX is a” namespace “, but here it is used as a” type “

Recently, I encountered this problem several times when learning C #. When writing ArrayList and StringBuilder, the main function will report the error that “XXXXXX is a” namespace “, but it is used as a” type “here. After several times of searching for information, we finally know where the mistake is.

For the convenience of the diagram, you can name the project name directly as the class name. That’s the mistake. The priority of the namespace is higher than the class name. Just change the project name when you create a new project.

In short, avoid duplicate class and project names.

[unable to calculate item metadata “% (fullpath)” unable to apply item metadata “% (fullpath)” to path] problem solving

Recently, I downloaded a project from SVN to local. I encountered a problem in the process of opening it with visual studio. The problems encountered are as follows:

Cannot evaluate item metadata ‘% (fullpath)’. Cannot apply item metadata “% (fullpath)” to path “obj/debug/xxx… \ Basic.DomainModel.Model .dll”。

After searching in many ways, it is found that the problem is that the folder of this project is too long from top to bottom. Vs identifies the problem. That is to say, vs limits the total length of the file path in the project.

Solution: shorten the name of the upper folder where the. SLN file is located, or reduce the number of depth layers of the folder to a certain range.

Unity Component.isActiveAndEnabled Analysis of exact meaning

The following results are the test conclusions.

Isactive in hierachy is equivalent to whether a GameObject is active or not, which is the same as a simple understanding.

Isactive andenabled requires three conditions:

The isactiveinheerachy of

    GameObject is true, and onenable
is being or has been called

So:

    in onenable of a script, isactive andenabled is always true. In ondisable of a script, isactive andenabled is always false

 

Test example: place a GameObject in the scene and two scripts below. Set GameObject and scripts to be active. In the process of running the scenario, in the script that calls onenable first, you can find that your isactive andenabled is true, but another script’s isactive andenabled is false.

So: there is no script to call onenable, though gameObject.isActiveInHierachy Is true, and enabled is true, but isactive andenabled is false.

 

Compiler error message: cs1056: unexpected character handling

Error generation:
always returns an error when compiling a pre-existing program code using VS2015. strange In some added to the end of the class file some [] [] [] [], prompt Unexpected character, ‘application error.

A compilation error as shown in the title was caused by a special full-corner character in C# code. > special full-corner characters are not displayed and saved in UTF-8 format, and the compiler cannot correctly recognize such characters, resulting in compilation errors.

solution:
set the file open mode of VS 2015, make it contains a file with the Angle of all special characters use utf-8 format to open.
>
1) In Solution Explorer, select the file that needs special opening. 2) Right-click the mouse button to pop up the menu, select “Open Mode”, and use “Charp Editor with Encoding” to open.

Reproduced in: https://blog.51cto.com/studybao/2048899

Three methods of referencing DLL in Visual Studio 2015

Copy the DLL file to the directory where the executable is located
 
2. Transfer engineering attributes ->; Configure properties ->; Debugging – & gt; Change the working directory to the directory where the DLL files reside
 
3. Transfer engineering attributes ->; Configure properties ->; Debugging – & gt; Set the environment to the Path= DLL directory, for example: Path=$(SolutionDir)bin
 

Reproduced in: https://www.cnblogs.com/buyishi/p/10236780.html

Prompt “failed to load file or assembly” when VTK uses renderwindowcontrol

Possible reasons:

The Activiz.net library downloaded on the CPU version does not match the local CPU version

>

download Activiz.net source code compilation of anyCPU version of the library.

Activiz.net source: https://github.com/bitzhuwei/Kitware.VTK.git

>
>
>
>
>
>
>
>
>
>
>
>

2, select Kitware project right click modify project properties – “build -” target platform anyCPU compilation

=
=
=
=

OpenGL learning notes and other learning thinking

Recently, I have not written a blog for many days, which is a very bad habit. If you don’t summarize what you learn every day, you basically forget it all. So keep blogging.
Review of C# programming basics
Three key words:

    new: (1) : Create object. To carve out a space in the heap (the object is a reference type, so it carve out space in the heap), to create an object in the carve out space, and to call the class’s no-argument constructor

(2) : completely hide the parent class method of the same name means to inherit the child class and the parent class method of the same name, need to completely hide the parent class method of the use
2. This: (1) : Refers to the object of the current class, especially when used in constructors. That’s what this means
(2) : inherit its own constructor (usually inherit the most complete constructor)
3. Base: (1) : When a constructor from a parent class is used for inheritance
Interface design: (1) : the menu bar has data resources, satellite resources, service resources, plug-in resources, thematic space, global target, resource search
(2) : open, image mode, map mode, chart mode, 3D terrain, place name management, basic data setting, automatic hiding, full screen, help, login, exit
(3) : tool set includes: area measurement tool, text information lead and organization association, manual correction, image data management in application, distance measurement tool, spatial viewable area analysis, global basic image download
(4) : Title bar WPF, global target, display boundary line, landing, meteorological and hydrological data display, new sky empty box.
What is not clear: which space is used for the full screen display (that is, the toolbar is hidden and the top logo bar is removed) and the toolset?Decreases the transparency of the control if the implementation mouse is not over it.
 
OpenGL: Let’s look at functions first. Learning OpenGL for so long, the feeling is to know the OpenGL rendering process and all kinds of small details, and then is to learn all kinds of functions
1: Readback data from the cache object: GlGetBufferSubData
2. Direct access to data in cache: Glenum Target, Glenum Access
GlumMapBuffer () = glumMapBuffer ()
More accurate access mode: GlmapBufferRange (Glenum Target, GlintPtr Offset, GlSizeiPtr Length, GlBitField Access);
5: abandon part or data in the cache object: glinvalidateBufferData glinvalidateBufferSubData () ()
Style (GLuint index,GLint size,GLenum type, GLboolean normalized, GLsizei stide, const GLvoid*pointer); The initialized property pointer index is passed to this function.
Integer vertex property: glVertexAttribiPointer () does not perform an automatic conversion to a floating point number
Double vertex attribute: glVertexAttriblPointer () whose type must be DOUBLE
9: Compressed format of vertex attributes: ????????
The vertex properties of each property can be set using the GlvertexAttrib *() series of parameters
11: OpenGL drawing command: includes two parts
1: GlDrawElements (GLenum mode,GLsizei count, GLenum type,Const GLvoid* indices) uses count elements to define a set of geometric primitives. The element’s index value is stored in a cache bound up to GL_ELEMENT_ARRAY_BUFFER. Indices defines the offset address in the element array cache. This function reads information about vertices from the currently enabled array of vertex properties and uses them to build the primitive type specified by mode. The index data from the element array cache is used to index each vertex attribute array 2: non-indexed form: basic drawing command: glDraWarRays () directly selects and uses the vertex attributes in their own order in the cached object.
 

Reproduced in: https://www.cnblogs.com/Audient/p/7643832.html